SQLBindByte
From SCAR Divi Manual
Definition
procedure SQLBindByte(const QueryIndex, ParamIndex: Integer; const _Byte: Byte);
Availability
SCAR Divi 3.31 > Current
Description
Binds a Byte parameter _Byte 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, byte INTEGER)');
Query := SQLQueryEx(DB, 'INSERT INTO test VALUES(NULL, ?)');
try
SQLBindByte(Query, 1, 168);
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(IntToStr(SQLColumnByte(Query, 1)));
finally
SQLQueryFree(Query);
end;
finally
SQLFree(DB);
end;
end.Output:
127