internal static void Bind(sqlite3 db, sqlite3_stmt stm, int index, object value) { int rc = 0; if (value == null) { rc = raw.sqlite3_bind_null(stm, index); } else { if (IsSupportedInteger(value)) { rc = raw.sqlite3_bind_int64(stm, index, GetInteger(value)); } else if (IsSupportedFloat(value)) { rc = raw.sqlite3_bind_double(stm, index, GetFloat(value)); } else if (IsSupportedText(value)) { rc = raw.sqlite3_bind_text(stm, index, value.ToString()); } else if (value is byte[]) { rc = raw.sqlite3_bind_blob(stm, index, (byte[])value); } else { throw new SQLiteException("Unable to bind parameter with unsupported type: " + value.GetType().FullName); } } VerifySQLiteResponse(rc, raw.SQLITE_OK, db); }
internal Cursor (sqlite3_stmt stmt, object dbLock) { this.dbLock = dbLock; this.statement = stmt; currentRow = -1; lock (dbLock) { currentStep = statement.step(); } }
static public int sqlite3_reset(sqlite3_stmt stmt) { return(_imp.sqlite3_reset(stmt.ptr)); }
static public int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt, out string tail) { IntPtr p; int rc = _imp.sqlite3_prepare_v2(db.ptr, sql, out p, out tail); stmt = new sqlite3_stmt(p, db); return rc; }
static public int sqlite3_stmt_readonly(sqlite3_stmt stmt) { return _imp.sqlite3_stmt_readonly(stmt.ptr); }
static public long sqlite3_column_int64(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_int64(stmt.ptr, index); }
static public int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] blob) { return _imp.sqlite3_bind_blob(stmt.ptr, index, blob); }
static public int sqlite3_bind_text(sqlite3_stmt stmt, int index, string val) { return _imp.sqlite3_bind_text(stmt.ptr, index, val); }
static public int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] blob) { return(sqlite3_bind_blob(stmt, index, blob, blob.Length)); }
static public sqlite3 sqlite3_db_handle(sqlite3_stmt stmt) { #if not IntPtr p = _imp.sqlite3_db_handle(stmt.ptr); Assert(p == stmt.db.ptr); #endif return stmt.db; }
static public int sqlite3_bind_zeroblob(sqlite3_stmt stmt, int index, int size) { return(_imp.sqlite3_bind_zeroblob(stmt.ptr, index, size)); }
static public string sqlite3_bind_parameter_name(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_bind_parameter_name(stmt.ptr, index)); }
static public string sqlite3_sql(sqlite3_stmt stmt) { return(_imp.sqlite3_sql(stmt.ptr)); }
public static int sqlite3_stmt_status(sqlite3_stmt stmt, int op, int resetFlg) { return(_imp.sqlite3_stmt_status(stmt.ptr, op, resetFlg)); }
static public int sqlite3_clear_bindings(sqlite3_stmt stmt) { return(_imp.sqlite3_clear_bindings(stmt.ptr)); }
static public int sqlite3_reset(sqlite3_stmt stmt) { return _imp.sqlite3_reset(stmt.ptr); }
static public int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte[] blob, int nSize) { return(_imp.sqlite3_bind_blob(stmt.ptr, index, blob, nSize)); }
public static int sqlite3_stmt_status(sqlite3_stmt stmt, int op, int resetFlg) { return _imp.sqlite3_stmt_status(stmt.ptr, op, resetFlg); }
static public int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val) { return(_imp.sqlite3_bind_double(stmt.ptr, index, val)); }
static public int sqlite3_bind_zeroblob(sqlite3_stmt stmt, int index, int size) { return _imp.sqlite3_bind_zeroblob(stmt.ptr, index, size); }
static public int sqlite3_bind_int64(sqlite3_stmt stmt, int index, long val) { return(_imp.sqlite3_bind_int64(stmt.ptr, index, val)); }
static public int sqlite3_bind_int64(sqlite3_stmt stmt, int index, long val) { return _imp.sqlite3_bind_int64(stmt.ptr, index, val); }
static public int sqlite3_bind_null(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_bind_null(stmt.ptr, index)); }
static public int sqlite3_bind_parameter_index(sqlite3_stmt stmt, string strName) { return _imp.sqlite3_bind_parameter_index(stmt.ptr, strName); }
static public int sqlite3_bind_text(sqlite3_stmt stmt, int index, string val) { return(_imp.sqlite3_bind_text(stmt.ptr, index, val)); }
static public int sqlite3_data_count(sqlite3_stmt stmt) { return _imp.sqlite3_data_count(stmt.ptr); }
static public int sqlite3_bind_parameter_count(sqlite3_stmt stmt) { return(_imp.sqlite3_bind_parameter_count(stmt.ptr)); }
static public int sqlite3_column_type(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_type(stmt.ptr, index); }
static public int sqlite3_bind_parameter_index(sqlite3_stmt stmt, string strName) { return(_imp.sqlite3_bind_parameter_index(stmt.ptr, strName)); }
static public int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt) { string tail; return sqlite3_prepare_v2(db, sql, out stmt, out tail); }
static public int sqlite3_stmt_busy(sqlite3_stmt stmt) { return(_imp.sqlite3_stmt_busy(stmt.ptr)); }
static public int sqlite3_finalize(sqlite3_stmt stmt) { int rc = _imp.sqlite3_finalize(stmt.ptr); stmt.set_already_disposed(); return rc; }
static public int sqlite3_stmt_readonly(sqlite3_stmt stmt) { return(_imp.sqlite3_stmt_readonly(stmt.ptr)); }
static public int sqlite3_clear_bindings(sqlite3_stmt stmt) { return _imp.sqlite3_clear_bindings(stmt.ptr); }
static public string sqlite3_column_table_name(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_table_name(stmt.ptr, index)); }
static public string sqlite3_sql(sqlite3_stmt stmt) { return _imp.sqlite3_sql(stmt.ptr); }
static public int sqlite3_data_count(sqlite3_stmt stmt) { return(_imp.sqlite3_data_count(stmt.ptr)); }
static public sqlite3_stmt sqlite3_next_stmt(sqlite3 db, sqlite3_stmt stmt) { IntPtr prev = IntPtr.Zero; if (stmt != null) { prev = stmt.ptr; } IntPtr p = _imp.sqlite3_next_stmt(db.ptr, prev); if (p == IntPtr.Zero) { return null; } else { return db.find_stmt(p); } }
static public double sqlite3_column_double(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_double(stmt.ptr, index)); }
static public string sqlite3_bind_parameter_name(sqlite3_stmt stmt, int index) { return _imp.sqlite3_bind_parameter_name(stmt.ptr, index); }
static public long sqlite3_column_int64(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_int64(stmt.ptr, index)); }
static public int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val) { return _imp.sqlite3_bind_double(stmt.ptr, index, val); }
static public byte[] sqlite3_column_blob(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_blob(stmt.ptr, index)); }
static public int sqlite3_bind_null(sqlite3_stmt stmt, int index) { return _imp.sqlite3_bind_null(stmt.ptr, index); }
static public int sqlite3_column_blob(sqlite3_stmt stmt, int index, byte[] result, int offset) { return(_imp.sqlite3_column_blob(stmt.ptr, index, result, offset)); }
static public int sqlite3_bind_parameter_count(sqlite3_stmt stmt) { return _imp.sqlite3_bind_parameter_count(stmt.ptr); }
static public int sqlite3_column_type(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_type(stmt.ptr, index)); }
static public int sqlite3_stmt_busy(sqlite3_stmt stmt) { return _imp.sqlite3_stmt_busy(stmt.ptr); }
static public string sqlite3_column_decltype(sqlite3_stmt stmt, int index) { return(_imp.sqlite3_column_decltype(stmt.ptr, index)); }
static public string sqlite3_column_table_name(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_table_name(stmt.ptr, index); }
public void Open() { statement = SQLite3.Prepare2(database.Handle, query); }
static public double sqlite3_column_double(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_double(stmt.ptr, index); }
internal void add_stmt(sqlite3_stmt stmt) { _stmts[stmt.ptr] = stmt; }
static public byte[] sqlite3_column_blob(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_blob(stmt.ptr, index); }
internal void remove_stmt(sqlite3_stmt s) { _stmts.Remove(s.ptr); }
static public string sqlite3_column_decltype(sqlite3_stmt stmt, int index) { return _imp.sqlite3_column_decltype(stmt.ptr, index); }
static public int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt) { string tail; return(sqlite3_prepare_v2(db, sql, out stmt, out tail)); }