#include <kcs/sqlite3.h>sqlite3_t for database, and sqlite3_stmt_t for statement.
No public members.
sqlite3_t *sqlite3_open(const char *filename, int timeout);- Opens the database with
filename. timeoutfor busy timeout in millisec.SQLITE_NO_TIMEOUTfor no timeout.- Returns
SQLITE_OKfor successful.
int sqlite3_close(sqlite3_t *db);- Closes the database.
- Do not use a closed database.
- Returns
SQLITE_OKfor successful.
sqlite3_stmt_t *sqlite3_prepare(sqlite3_t *db, const char *sql);- Prepares the statement object created by
sql.
void sqlite3_finalize(sqlite3_stmt_t *stmt);- Closes the statement.
- Do not use a closed statement.
int sqlite3_clear_bindings(sqlite3_stmt_t *stmt);- Clears the all bound values.
- Returns
SQLITE_OKfor successful.
int sqlite3_reset(sqlite3_stmt_t *stmt);- Resets the statement state.
- Bound data would not be cleared, use
sqlite3_clear_bindingsfor that purpose. - Returns
SQLITE_OKfor successful.
int sqlite3_step(sqlite3_stmt_t *stmt);- Executes a step for the statement.
SQLITE_ROWmeans the success of reading a row.SQLITE_DONEmeans reading has been done until the end.
int sqlite3_bind_null(sqlite3_stmt_t *stmt, int index);- Binds
NULLto the placeholder specified by theindex. indexshould be started from 1.- Returns
SQLITE_OKfor successful.
int sqlite3_bind_blob(sqlite3_stmt_t *stmt, int index, void *blob, int len, int mkcopy);- Binds blob data to the placeholder specified by the
index. indexshould be started from 1.- Returns
SQLITE_OKfor successful.
int sqlite3_bind_double(sqlite3_stmt_t *stmt, int index, double val);- Binds a double value to the placeholder specified by the
index. indexshould be started from 1.- Returns
SQLITE_OKfor successful.
int sqlite3_bind_int(sqlite3_stmt_t *stmt, int index, int val);- Binds a integer value to the placeholder specified by the
index. indexshould be started from 1.- Returns
SQLITE_OKfor successful.
int sqlite3_bind_text(sqlite3_stmt_t *stmt, int index, const char *val, int len);- Binds a text value to the placeholder specified by the
index. indexshould be started from 1.- Returns
SQLITE_OKfor successful.
int sqlite3_column_count(sqlite3_stmt_t *stmt);- Returns the column count of row.
int sqlite3_column_type(sqlite3_stmt_t *stmt, int index);- Returns the type of the column specified by the
index. indexshould be started from 0.- Types should be:
SQLITE_INTEGERfor integer.SQLITE_FLOATfor double.SQLITE_TEXTfor text string.SQLITE_BLOBfor blob data.SQLITE_NULLforNULL.
int sqlite3_column_bytes(sqlite3_stmt_t *stmt, int index);- Returns the data bytes of the column specified by the
index. indexshould be started from 0.
int64_t sqlite3_column_int(sqlite3_stmt_t *stmt, int index);- Returns a integer value of the column specified by the
index. indexshould be started from 0.
double sqlite3_column_double(sqlite3_stmt_t *stmt, int index);- Returns a double value of the column specified by the
index. indexshould be started from 0.
void *sqlite3_column_blob(sqlite3_stmt_t *stmt, int index);- Returns blob data of the column specified by the
index. indexshould be started from 0.
const char *sqlite3_column_text(sqlite3_stmt_t *stmt, int index);- Returns a text value of the column specified by the
index. indexshould be started from 0.
const char *sqlite3_column_name(sqlite3_stmt_t *stmt, int index);- Returns the name of the column specified by the
index. indexshould be started from 0.
int sqlite3_exec(sqlite3_t *db, const char *sql);- Executes the sql of
sqlin one action. - Returns
SQLITE_OKfor successful.
const char *sqlite3_last_errmsg(sqlite3_t *db);- Returns a last error message.