Difference between revisions of "SQLBindInt64"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> procedure SQLBindInt64(const QueryIndex, ParamIndex: Integer; const Int: Int64); </source> ==Availability== SCAR Divi 3.31 > Cu...")
 
(No difference)

Latest revision as of 10:30, 14 February 2012

Definition

procedure SQLBindInt64(const QueryIndex, ParamIndex: Integer; const Int: Int64);

Availability

SCAR Divi 3.31 > Current

Description

Binds an Int64 parameter Int to an SQLite3 query statement given by QueryIndex at the parameter index given by ParamIndex. A parameter is specified in your query by "?" and the index is offset at 1 rather than 0.

Example

var
  DB, Query, InsertID: Integer;

begin
  DB := SQLOpen(WorkspacePath + 'test.db3', True);
  try
    SQLQuery(DB, 'CREATE TABLE IF NOT EXISTS test(id INTEGER PRIMARY KEY, int64 INTEGER)');
    Query := SQLQueryEx(DB, 'INSERT INTO test VALUES(NULL, ?)');
    try
      SQLBindInt64(Query, 1, 1099511627776);
      SQLQueryStep(Query);
      InsertID := SQLLastID(DB);
    finally
      SQLQueryFree(Query);
    end;
    Query := SQLQueryEx(DB, 'SELECT * FROM test WHERE id = ?');
    try
      SQLBindInt(Query, 1, InsertID);
      if SQLQueryStep(Query) = SQL_ROW then
        WriteLn(Int64ToStr(SQLColumnInt64(Query, 1)));
    finally
      SQLQueryFree(Query);
    end;
  finally
    SQLFree(DB);
  end;
end.

Output:

1099511627776

See Also