exa/sqlite/common

Search:
Group by:
Source   Edit  

This module provides the base objects used by the SQLite module.

Types

DbConn = ref object
  profile*: DbConnProfile    ## A profile that the database connection was opened with
  conn*: lib.Sqlite3         ## The actual database connection itself
  cache*: Table[string, Stmt] ## A cache of statements, enhances performance.
The main database connection object Source   Edit  
DbConnProfile {.pure.} = enum
  Default,                  ## Doesn't activate any options
  Minimal,                  ## Enables WAL and foreign keys, this allows for greater concurrency when using SQLite anywhere but a network. Ideally used for short-lived database connections.
  Server                     ## WAL, foreign keys, normal synchronous mode and other options that are typically great for web apps. Ideally used for long-lived database connections.
Allows you to specify a preset of options, the default profile is Minimal which enables WAL and Foreign Keys, Source   Edit  
DbError = object of CatchableError
Source   Edit  
DbPool = object
  conns*: seq[DbConn]
  lock*: Lock
  cond*: Cond
Connection pool for SQLite Source   Edit  
DbRow = seq[DbValue]
An individual row containing several database values. Source   Edit  
DbValue = object
  case kind*: DbValueKind
  of Text:
    strVal*: string
  of Integer:
    intVal*: int64
  of Blob:
    blobVal*: seq[byte]
  of Float:
    floatVal*: float64
  of Null:
    nil
A "database value", this type basically represents all of the types supported by SQLite in a single object. Source   Edit  
DbValueKind {.pure.} = enum
  Text,                     ## String values
  Integer,                  ## Integer value
  Blob,                     ## Binary data
  Float,                    ## Float (decimal) data
  Null                       ## A literal `NULL` character from SQLite
Used to denote types in database values (and rows) Source   Edit