/// <summary> /// Initializes the statement and attempts to get all information about parameters in the statement /// </summary> /// <param name="sqlbase">The base SQLite object</param> /// <param name="stmt">The statement</param> /// <param name="strCommand">The command text for this statement</param> /// <param name="previous">The previous command in a multi-statement command</param> internal SqliteStatement(SQLiteBase sqlbase, SqliteStatementHandle stmt, string strCommand, SqliteStatement previous) { _sql = sqlbase; _sqlite_stmt = stmt; _sqlStatement = strCommand; // Determine parameters for this statement (if any) and prepare space for them. int nCmdStart = 0; int n = _sql.Bind_ParamCount(this); int x; string s; if (n > 0) { if (previous != null) nCmdStart = previous._unnamedParameters; _paramNames = new string[n]; _paramValues = new SqliteParameter[n]; for (x = 0; x < n; x++) { s = _sql.Bind_ParamName(this, x + 1); if (String.IsNullOrEmpty(s)) { s = String.Format(CultureInfo.InvariantCulture, ";{0}", nCmdStart); nCmdStart++; _unnamedParameters++; } _paramNames[x] = s; _paramValues[x] = null; } } }
internal static void Dispose(this SqliteStatementHandle statement) { try { SqliteBase.FinalizeStatement(statement); } catch (SqliteException) { } }
internal static void FinalizeStatement(SqliteStatementHandle stmt) { lock (_lock) { int n = UnsafeNativeMethods.sqlite3_finalize(stmt); if (n > 0) { throw new SqliteException(n, null); } } }
public static int sqlite3_prepare16( SqliteConnectionHandle connection, string sql, int sqlLength, out SqliteStatementHandle statement, out string remainingSql) { SqliteStatementHandle innerStmt; var res = sqlite3_prepare(connection, sql, sqlLength, out innerStmt, out remainingSql); statement = innerStmt; return(res); }
public static int sqlite3_prepare( SqliteConnectionHandle connection, string sql, int sqlLength, out SqliteStatementHandle statement, out string remainingSql) { Community.CsharpSqlite.Sqlite3.Vdbe stmt = null; string remSql = null; var result = Community.CsharpSqlite.Sqlite3.sqlite3_prepare(connection.Handle, sql, sqlLength, ref stmt, ref remSql); statement = new SqliteStatementHandle(stmt); remainingSql = remSql; return(result); }
internal static void ResetConnection(SqliteConnectionHandle db) { lock (_lock) { SqliteStatementHandle stmt = null; do { stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt); if (stmt != null) { UnsafeNativeMethods.sqlite3_reset(stmt); } } while (stmt != null); // Not overly concerned with the return value from a rollback. string msg = null; UnsafeNativeMethods.sqlite3_exec(db, "ROLLBACK", out msg); } }
public static string sqlite3_column_table_name(SqliteStatementHandle statement, int index) { return Community.CsharpSqlite.Sqlite3.sqlite3_column_table_name(statement.Handle, index); }
public static int sqlite3_prepare16(SqliteConnectionHandle db, string query, int length, out SqliteStatementHandle statement, out string strRemain) { throw new System.NotImplementedException(); }
public static int sqlite3_bind_parameter_index(SqliteStatementHandle statement, string name) { return Community.CsharpSqlite.Sqlite3.sqlite3_bind_parameter_index(statement.Handle, name); }
public static SqliteStatementHandle sqlite3_next_stmt(SqliteConnectionHandle db, SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
public static byte[] sqlite3_column_blob(SqliteStatementHandle __unnamed000, int index) { throw new System.NotImplementedException(); }
public static int sqlite3_bind_parameter_count(SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
public static extern SQLiteColumnType sqlite3_column_type(SqliteStatementHandle statement, int ordinal);
/// <summary> /// Disposes and finalizes the statement /// </summary> public void Dispose() { if (_sqlite_stmt != null) { _sqlite_stmt.Dispose(); } _sqlite_stmt = null; _paramNames = null; _paramValues = null; _sql = null; _sqlStatement = null; }
public static SqliteStatementHandle sqlite3_next_stmt(SqliteConnectionHandle connection, SqliteStatementHandle statement) { var res = Community.CsharpSqlite.Sqlite3.sqlite3_next_stmt(connection.Handle, statement == null ? null : statement.Handle); if (res == null) return null; return new SqliteStatementHandle(res); }
public static int sqlite3_finalize(SqliteStatementHandle statement) { return Community.CsharpSqlite.Sqlite3.sqlite3_finalize(statement.Handle); }
public static string sqlite3_column_table_name16(SqliteStatementHandle statement, int index) { return sqlite3_column_table_name(statement, index); }
public static string sqlite3_column_text16(SqliteStatementHandle statement, int index) { return sqlite3_column_text(statement, index); }
public static int sqlite3_bind_text16(SqliteStatementHandle statement, int index, string value, int textLength) { return sqlite3_bind_text(statement, index, value, textLength, null); }
public static extern double sqlite3_column_double(SqliteStatementHandle stmt, int index);
public static extern long sqlite3_column_int64(SqliteStatementHandle stmt, int index);
public static long sqlite3_column_int64(SqliteStatementHandle statement, int index) { return Community.CsharpSqlite.Sqlite3.sqlite3_column_int64(statement.Handle, index); }
public static int sqlite3_bind_int64(SqliteStatementHandle statement, int index, long value) { throw new System.NotImplementedException(); }
public static byte[] sqlite3_column_blob(SqliteStatementHandle statement, int index) { return Community.CsharpSqlite.Sqlite3.sqlite3_column_blob(statement.Handle, index); }
public static string sqlite3_bind_parameter_name(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
public static int sqlite3_column_count(SqliteStatementHandle statement) { return Community.CsharpSqlite.Sqlite3.sqlite3_column_count(statement.Handle); }
public static string sqlite3_column_table_name16(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
internal static void FinalizeStatement(SqliteStatementHandle stmt) { lock (_lock) { int n = UnsafeNativeMethods.sqlite3_finalize(stmt); if (n > 0) throw new SqliteException(n, null); } }
public static extern SQLiteErrorCode sqlite3_bind_null(SqliteStatementHandle stmt, int ordinal);
public static int sqlite3_prepare_v2(SqliteConnectionHandle db, string query, out SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
public static extern SQLiteErrorCode sqlite3_bind_text(SqliteStatementHandle stmt, int ordinal, byte[] value, int count, IntPtr free);
public static int sqlite3_step(SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
public static int sqlite3_column_type(SqliteStatementHandle statement, int index) { return Community.CsharpSqlite.Sqlite3.sqlite3_column_type(statement.Handle, index); }
public static extern SQLiteErrorCode sqlite3_bind_int64(SqliteStatementHandle stmt, int ordinal, long value);
public static int sqlite3_bind_blob(SqliteStatementHandle statement, int index, byte[] value, int length, object dummy) { throw new System.NotImplementedException(); }
public static extern int sqlite3_bind_parameter_index(SqliteStatementHandle stmt, byte[] zName);
public static extern int sqlite3_column_count(SqliteStatementHandle stmt);
public static int sqlite3_bind_null(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
public static extern int sqlite3_column_int(SqliteStatementHandle stmt, int index);
public static extern IntPtr sqlite3_column_text(SqliteStatementHandle stmt, int index);
public static int sqlite3_bind_parameter_index(SqliteStatementHandle statement, string name) { throw new System.NotImplementedException(); }
public static int sqlite3_bind_text16(SqliteStatementHandle statement, int index, string value, int length) { throw new System.NotImplementedException(); }
public static int sqlite3_column_count(SqliteStatementHandle rstatement) { throw new System.NotImplementedException(); }
public static int sqlite3_column_type(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
public static string sqlite3_bind_parameter_name(SqliteStatementHandle statement, int index) { return Community.CsharpSqlite.Sqlite3.sqlite3_bind_parameter_name(statement.Handle, index); }