No matching definitions.

sqlite/row

src/sqlite/row.tur
defn

col-count

(col-count [stmt :int] :int)

return the number of result columns in a prepared statement.

stmtstatement handle

Column count as :int.

(col-count stmt)  ; => 3

Since: P2

defn

col-name

(col-name [stmt :int i :int] :cstr)

return the name of a result column at 0-based index i.

stmtstatement handle (stepped to SQLITE_ROW)
i0-based column index

Column name as :cstr (valid until stmt is finalized).

(col-name stmt 0)  ; => "id"

Since: P2

defn

col-int

(col-int [stmt :int i :int] :int)

return the integer value of result column i from a stepped statement.

stmtstatement handle at SQLITE_ROW
i0-based column index

Column value as :int (int64_t).

(col-int stmt 0)  ; => 42

Since: P2

defn

col-real

(col-real [stmt :int i :int] :float)

return the real value of result column i from a stepped statement.

stmtstatement handle at SQLITE_ROW
i0-based column index

Column value as :float (double).

(col-real stmt 1)  ; => 3.14

Since: P2

defn

col-text

(col-text [stmt :int i :int] :cstr)

return the text value of result column i from a stepped statement.

stmtstatement handle at SQLITE_ROW
i0-based column index

Column text as :cstr; empty string if SQL NULL; valid until next step or finalize.

(col-text stmt 1)  ; => "Alice"

Since: P2

defn

col-type

(col-type [stmt :int i :int] :int)

return the storage type code of result column i.

stmtstatement handle at SQLITE_ROW
i0-based column index

SQLITE_INTEGER=1, SQLITE_FLOAT=2, SQLITE_TEXT=3, SQLITE_BLOB=4, SQLITE_NULL=5.

(col-type stmt 0)  ; => 1 (SQLITE_INTEGER)

Since: P2

defn

row-get

(row-get [row :int name :cstr] :cstr)

look up a column value by name in a db-query row alist.

rowrow alist from db-query (cons list of alternating name/value pairs)
namecolumn name to find

Column value as :cstr, or "" if the name is not present.

(row-get row "name")  ; => "Alice"

Since: P2

defn

row-keys

(row-keys [row :int] :int)

return a forward cons list of column names for a db-query row alist.

rowrow alist from db-query

Cons list of column name :cstr values (stored as :int); nil if row is empty.

(row-keys row)  ; => ("id" "name" "age")

Since: P2