Common datatypes and definitions for all db_*.nim ( db_mysql, db_postgres, and db_sqlite) modules.


DbError = object of IOError
exception that is raised if a database error occurs   Source Edit
SqlQuery = distinct string
an SQL query string   Source Edit
DbEffect = object of IOEffect
effect that denotes a database operation   Source Edit
ReadDbEffect = object of DbEffect
effect that denotes a read operation   Source Edit
WriteDbEffect = object of DbEffect
effect that denotes a write operation   Source Edit
DbTypeKind = enum
  dbUnknown, dbSerial, dbNull, dbBit, dbBool, dbBlob, dbFixedChar, dbVarchar,
  dbJson, dbXml, dbInt, dbUInt, dbDecimal, dbFloat, dbDate, dbTime, dbDatetime,
  dbTimestamp, dbTimeInterval, dbEnum, dbSet, dbArray, dbComposite, dbUrl,
  dbUuid, dbInet, dbMacAddress, dbGeometry, dbPoint, dbLine, dbLseg, dbBox,
  dbPath, dbPolygon, dbCircle, dbUser1, dbUser2, dbUser3, dbUser4, dbUser5
a superset of datatypes that might be supported.   Source Edit
DbType = object
  kind*: DbTypeKind          ## the kind of the described type
  notNull*: bool             ## does the type contain NULL?
  name*: string              ## the name of the type
  size*: Natural             ## the size of the datatype; 0 if of variable size
  maxReprLen*: Natural       ## maximal length required for the representation
  precision*, scale*: Natural ## precision and scale of the number
  min*, max*: BiggestInt     ## the minimum and maximum of allowed values
  validValues*: seq[string]  ## valid values of an enum or a set
describes a database type   Source Edit
DbColumn = object
  name*: string              ## name of the column
  tableName*: string         ## name of the table the column belongs to (optional)
  typ*: DbType               ## type of the column
  primaryKey*: bool          ## is this a primary key?
  foreignKey*: bool          ## is this a foreign key?
information about a database column   Source Edit
DbColumns = seq[DbColumn]
  Source Edit


proc dbError(msg: string) {...}{.noreturn, noinline, raises: [DbError], tags: [].}
raises an DbError exception with message msg.   Source Edit


template sql(query: string): SqlQuery

constructs a SqlQuery from the string query. This is supposed to be used as a raw-string-literal modifier: sql"update user set counter = counter + 1"

If assertions are turned off, it does nothing. If assertions are turned on, later versions will check the string for valid syntax.

  Source Edit