예제 #1
0
    /// <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;
        }
      }
    }
예제 #2
0
 internal static void Dispose(this SqliteStatementHandle statement)
 {
     try {
         SqliteBase.FinalizeStatement(statement);
     }
     catch (SqliteException) {
     }
 }
예제 #3
0
 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);
        }
예제 #6
0
        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);
 }
예제 #10
0
 public static SqliteStatementHandle sqlite3_next_stmt(SqliteConnectionHandle db, SqliteStatementHandle statement)
 {
     throw new System.NotImplementedException();
 }
예제 #11
0
 public static byte[] sqlite3_column_blob(SqliteStatementHandle __unnamed000, int index)
 {
     throw new System.NotImplementedException();
 }
예제 #12
0
 public static int sqlite3_bind_parameter_count(SqliteStatementHandle statement)
 {
     throw new System.NotImplementedException();
 }
예제 #13
0
 public static extern SQLiteColumnType sqlite3_column_type(SqliteStatementHandle statement, int ordinal);
예제 #14
0
 /// <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);
 }
예제 #20
0
 public static extern double sqlite3_column_double(SqliteStatementHandle stmt, int index);
예제 #21
0
 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);
 }
예제 #23
0
 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);
 }
예제 #25
0
 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);
 }
예제 #27
0
 public static string sqlite3_column_table_name16(SqliteStatementHandle statement, int index)
 {
     throw new System.NotImplementedException();
 }
예제 #28
0
 internal static void FinalizeStatement(SqliteStatementHandle stmt) {
     lock (_lock) {
         int n = UnsafeNativeMethods.sqlite3_finalize(stmt);
         if (n > 0) throw new SqliteException(n, null);
     }
 }
예제 #29
0
 public static int sqlite3_prepare16(SqliteConnectionHandle db, string query, int length, out SqliteStatementHandle statement, out string strRemain)
 {
     throw new System.NotImplementedException();
 }
예제 #30
0
 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(); }
예제 #32
0
 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);
 }
예제 #35
0
 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(); }
예제 #37
0
 public static extern int sqlite3_bind_parameter_index(SqliteStatementHandle stmt, byte[] zName);
 public static int sqlite3_bind_int64(SqliteStatementHandle statement, int index, long value) { throw new System.NotImplementedException(); }
예제 #39
0
 public static extern int sqlite3_column_count(SqliteStatementHandle stmt);
 public static int sqlite3_bind_null(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
예제 #41
0
 public static extern int sqlite3_column_int(SqliteStatementHandle stmt, int index);
 public static int sqlite3_bind_parameter_count(SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
예제 #43
0
 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(); }
예제 #45
0
 public static int sqlite3_bind_blob(SqliteStatementHandle statement, int index, byte[] value, int length, object dummy)
 {
     throw new System.NotImplementedException();
 }
 public static string sqlite3_bind_parameter_name(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
예제 #47
0
 public static int sqlite3_bind_null(SqliteStatementHandle statement, int index)
 {
     throw new System.NotImplementedException();
 }
 public static int sqlite3_bind_text16(SqliteStatementHandle statement, int index, string value, int length) { throw new System.NotImplementedException(); }
예제 #49
0
 public static int sqlite3_bind_parameter_index(SqliteStatementHandle statement, string name)
 {
     throw new System.NotImplementedException();
 }
 public static byte[] sqlite3_column_blob(SqliteStatementHandle __unnamed000, int index) { throw new System.NotImplementedException(); }
예제 #51
0
 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(); }
예제 #53
0
 public static int sqlite3_column_count(SqliteStatementHandle rstatement)
 {
     throw new System.NotImplementedException();
 }
 public static string sqlite3_column_table_name16(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
예제 #55
0
 public static int sqlite3_column_type(SqliteStatementHandle statement, int index)
 {
     throw new System.NotImplementedException();
 }
 public static int sqlite3_column_type(SqliteStatementHandle statement, int index) { throw new System.NotImplementedException(); }
예제 #57
0
 public static int sqlite3_prepare_v2(SqliteConnectionHandle db, string query, out SqliteStatementHandle statement)
 {
     throw new System.NotImplementedException();
 }
 public static SqliteStatementHandle sqlite3_next_stmt(SqliteConnectionHandle db, SqliteStatementHandle statement) { throw new System.NotImplementedException(); }
예제 #59
0
 public static int sqlite3_step(SqliteStatementHandle statement)
 {
     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);
 }