Skip to content

SQLite3Statement


class SQLite3Statement

Wrapper for sqlite3_stmt struct.

Member Functions

Name Description
bind Bind argument to a parameter.
bind Bind argument to a parameter.
bind Bind argument to a parameter.
bindNull Bind null argument to a parameter.
step Execute the statement one step.
columnCount Number of columns in the result.
columnInteger Get column value as an integer.
columnReal Get column value as a real.
columnString Get column value as a string.
columnNull Is the column value null?
reset Reset the statement for reuse.
finalize Finalize the statement.

Member Function Details

bind

function bind(i:Integer, x:Integer)

Bind argument to a parameter.

  • i: Parameter index, 1-based.
  • x: Argument.

function bind(i:Integer, x:Real)

Bind argument to a parameter.

  • i: Parameter index, 1-based.
  • x: Argument.

function bind(i:Integer, x:String)

Bind argument to a parameter.

  • i: Parameter index, 1-based.
  • x: Argument.

bindNull

function bindNull(i:Integer)

Bind null argument to a parameter.

  • i: Parameter index, 1-based.

columnCount

function columnCount() -> Integer

Number of columns in the result.

columnInteger

function columnInteger(i:Integer) -> Integer?

Get column value as an integer.

  • i: Column index, 1-based.

Return: Optional with a value if the column value is a non-null integer.

columnNull

function columnNull(i:Integer) -> Boolean

Is the column value null?

  • i: Column index, 1-based.

columnReal

function columnReal(i:Integer) -> Real?

Get column value as a real.

  • i: Column index, 1-based.

Return: Optional with a value if the column value is a non-null real.

columnString

function columnString(i:Integer) -> String?

Get column value as a string.

  • i: Column index, 1-based.

Return: Optional with a value if the column value is a non-null string.

finalize

function finalize()

Finalize the statement.

reset

function reset()

Reset the statement for reuse.

step

function step() -> Boolean

Execute the statement one step. For a query, this returns true if there is a new row to read (using the column* functions) and false if there are no more rows to read. For an update, this returns false on success (as there are no results to read). Anything else throws an error.

Intenally, this is a simplified version of sqlite3_step. If sqlite3_step returns:

  • SQL_ROW it returns true,
  • SQL_DONE it returns false, and
  • anything else, throws and error.