public byte[] ColumnBlob(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     int length = ColumnBytes(stmt, index);
     byte[] result = new byte[length];
     if (length > 0)
         Marshal.Copy(SQLite3.ColumnBlob(dbStatement.InternalStmt, index), result, 0, length);
     return result;
 }
        public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free)
        {
            var dbStatement = (DbStatement)stmt;

            if (_useWinSqlite)
            {
                return WinSQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free);
            }
            else
            {
                return SQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free);
            }
        }
        public int BindInt(IDbStatement stmt, int index, int val)
        {
            var dbStatement = (DbStatement)stmt;

            if (_useWinSqlite)
            {
                return WinSQLite3.BindInt(dbStatement.InternalStmt, index, val);
            }
            else
            {
                return SQLite3.BindInt(dbStatement.InternalStmt, index, val);
            }
        }
        public int ExecuteNonQuery(object[] source)
        {
            Connection.TraceListener.WriteLine("Executing: {0}", CommandText);
            if (!Initialized)
            {
                Statement = Prepare();
                Initialized = true;
            }

            var sqlitePlatform = Connection.Platform;
            //bind the values.
            if (source != null)
            {
                for (var i = 0; i < source.Length; i++)
                {
                    SQLiteCommand.BindParameter(sqlitePlatform.SQLiteApi, Statement, i + 1, source[i],
                        Connection.StoreDateTimeAsTicks, Connection.Serializer);
                }
            }

            Result r;
            lock (_locker)
            {
                r = sqlitePlatform.SQLiteApi.Step(Statement);
            }

            if (r == Result.Done)
            {
                var rowsAffected = sqlitePlatform.SQLiteApi.Changes(Connection.Handle);
                sqlitePlatform.SQLiteApi.Reset(Statement);
                return rowsAffected;
            }
            if (r == Result.Error)
            {
                var msg = sqlitePlatform.SQLiteApi.Errmsg16(Connection.Handle);
                sqlitePlatform.SQLiteApi.Reset(Statement);
                throw SQLiteException.New(r, msg);
            }
            if (r == Result.Constraint && sqlitePlatform.SQLiteApi.ExtendedErrCode(Connection.Handle) == ExtendedResult.ConstraintNotNull)
            {
                sqlitePlatform.SQLiteApi.Reset(Statement);
                throw NotNullConstraintViolationException.New(r, sqlitePlatform.SQLiteApi.Errmsg16(Connection.Handle));
            }
            sqlitePlatform.SQLiteApi.Reset(Statement);

            throw SQLiteException.New(r, r.ToString());
        }
        public int ExecuteNonQuery(object[] source)
        {
            if (Connection.Trace)
            {
                Debug.WriteLine("Executing: " + CommandText);
            }

            var r = Result.OK;

            if (!Initialized)
            {
                Statement = Prepare();
                Initialized = true;
            }

            //bind the values.
            if (source != null)
            {
                for (int i = 0; i < source.Length; i++)
                {
                    SQLiteCommand.BindParameter(_sqlitePlatform.SQLiteApi, Statement, i + 1, source[i],
                        Connection.StoreDateTimeAsTicks);
                }
            }
            r = _sqlitePlatform.SQLiteApi.Step(Statement);

            if (r == Result.Done)
            {
                int rowsAffected = _sqlitePlatform.SQLiteApi.Changes(Connection.Handle);
                _sqlitePlatform.SQLiteApi.Reset(Statement);
                return rowsAffected;
            }
            if (r == Result.Error)
            {
                string msg = _sqlitePlatform.SQLiteApi.Errmsg16(Connection.Handle);
                _sqlitePlatform.SQLiteApi.Reset(Statement);
                throw SQLiteException.New(r, msg);
            }
            _sqlitePlatform.SQLiteApi.Reset(Statement);
            throw SQLiteException.New(r, r.ToString());
        }
 public bool Equals(IDbStatement other)
 {
     return((other is DbStatement) && ((DbStatement)other).InternalStmt == InternalStmt);
 }
Example #7
0
 public byte[] ColumnByteArray(IDbStatement stmt, int index)
 {
     var internalStmt = (DbStatement) stmt;
     return SQLiteApiWin32Internal.ColumnByteArray(internalStmt.StmtPtr, index);
 }
 public int BindParameterIndex(IDbStatement stmt, string name)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindParameterIndex(dbStatement.InternalStmt, name);
 }
        public string ColumnName16(IDbStatement stmt, int index)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.ColumnName16(dbStatement.InternalStmt, index));
        }
Example #10
0
 public string ColumnText16(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return Marshal.PtrToStringUni(SQLite3.ColumnText16(dbStatement.InternalStmt, index));
 }
Example #11
0
 public Result Step(IDbStatement stmt)
 {
     var dbStatement = (DbStatement)stmt;
     return (Result)SQLite3.Step(dbStatement.InternalStmt);
 }
        public int BindInt(IDbStatement stmt, int index, int val)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiGenericInternal.sqlite3_bind_int(internalStmt.StmtPtr, index, val));
        }
Example #13
0
 public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free);
 }
        public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.BindText(dbStatement.InternalStmt, index, val, n, free));
        }
Example #15
0
 protected override void OnPersistCommit(IDbStatement cmd, CommitAttempt attempt)
 {
     _raisedCommand       = cmd;
     _raisedCommitAttempt = attempt;
 }
        public int BindParameterIndex(IDbStatement stmt, string name)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.BindParameterIndex(dbStatement.InternalStmt, name));
        }
        public int BindNull(IDbStatement stmt, int index)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.BindNull(dbStatement.InternalStmt, index));
        }
        public int BindInt64(IDbStatement stmt, int index, long val)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.BindInt64(dbStatement.InternalStmt, index, val));
        }
Example #19
0
 public Result Reset(IDbStatement stmt)
 {
     var internalStmt = (DbStatement) stmt;
     return SQLiteApiWin32Internal.sqlite3_reset(internalStmt.StmtPtr);
 }
        public double ColumnDouble(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiGenericInternal.sqlite3_column_double(internalStmt.StmtPtr, index));
        }
Example #21
0
 public int ColumnBytes(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.ColumnBytes(dbStatement.InternalStmt, index);
 }
        public string ColumnText16(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(Marshal.PtrToStringUni(SQLiteApiGenericInternal.sqlite3_column_text16(internalStmt.StmtPtr, index)));
        }
Example #23
0
 public long ColumnInt64(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.ColumnInt64(dbStatement.InternalStmt, index);
 }
        public int ColumnBytes(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiGenericInternal.sqlite3_column_bytes(internalStmt.StmtPtr, index));
        }
Example #25
0
 public Result Finalize(IDbStatement stmt)
 {
     var dbStatement = (DbStatement)stmt;
     Sqlite3Statement internalStmt = dbStatement.InternalStmt;
     return (Result)SQLite3.Finalize(internalStmt);
 }
        public byte[] ColumnByteArray(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiGenericInternal.ColumnByteArray(internalStmt.StmtPtr, index));
        }
Example #27
0
 public int BindInt64(IDbStatement stmt, int index, long val)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindInt64(dbStatement.InternalStmt, index, val);
 }
        public int BindDouble(IDbStatement stmt, int index, double val)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.BindDouble(dbStatement.InternalStmt, index, val));
        }
Example #29
0
 public byte[] ColumnByteArray(IDbStatement stmt, int index)
 {
     return ColumnBlob(stmt, index);
 }
        public ColType ColumnType(IDbStatement stmt, int index)
        {
            var dbStatement = (DbStatement)stmt;

            return((ColType)SQLite3.ColumnType(dbStatement.InternalStmt, index));
        }
Example #31
0
 public string ColumnText16(IDbStatement stmt, int index)
 {
     var internalStmt = (DbStatement) stmt;
     return Marshal.PtrToStringUni(SQLiteApiWin32Internal.sqlite3_column_text16(internalStmt.StmtPtr, index));
 }
        public Result Step(IDbStatement stmt)
        {
            var dbStatement = (DbStatement)stmt;

            return((Result)SQLite3.Step(dbStatement.InternalStmt));
        }
 public bool Equals(IDbStatement other)
 {
     return(other is DbStatement && StmtPtr == ((DbStatement)other).StmtPtr);
 }
        public string ColumnText16(IDbStatement stmt, int index)
        {
            var dbStatement = (DbStatement)stmt;

            return(Marshal.PtrToStringUni(SQLite3.ColumnText16(dbStatement.InternalStmt, index)));
        }
Example #35
0
 public double ColumnDouble(IDbStatement stmt, int index)
 {
     var internalStmt = (DbStatement) stmt;
     return SQLiteApiWin32Internal.sqlite3_column_double(internalStmt.StmtPtr, index);
 }
        public Result Step(IDbStatement stmt)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiGenericInternal.sqlite3_step(internalStmt.StmtPtr));
        }
Example #37
0
 public int ColumnBytes(IDbStatement stmt, int index)
 {
     var internalStmt = (DbStatement) stmt;
     return SQLiteApiWin32Internal.sqlite3_column_bytes(internalStmt.StmtPtr, index);
 }
Example #38
0
        public Result Finalize(IDbStatement stmt)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_finalize(internalStmt.StmtPtr));
        }
Example #39
0
 public bool Equals(IDbStatement other)
 {
     return other is DbStatement && StmtPtr == ((DbStatement) other).StmtPtr;
 }
Example #40
0
        public int BindParameterIndex(IDbStatement stmt, string name)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_parameter_index(internalStmt.StmtPtr, name));
        }
Example #41
0
 public Result Finalize(IDbStatement stmt)
 {
     var internalStmt = (DbStatement) stmt;
     return SQLiteApiWin32Internal.sqlite3_finalize(internalStmt.StmtPtr);
 }
Example #42
0
        public int BindNull(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_null(internalStmt.StmtPtr, index));
        }
Example #43
0
 public int ColumnCount(IDbStatement stmt)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.ColumnCount(dbStatement.InternalStmt);
 }
Example #44
0
        public int BindInt64(IDbStatement stmt, int index, long val)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_int64(internalStmt.StmtPtr, index, val));
        }
Example #45
0
 public double ColumnDouble(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.ColumnDouble(dbStatement.InternalStmt, index);
 }
Example #46
0
        public int BindDouble(IDbStatement stmt, int index, double val)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_double(internalStmt.StmtPtr, index, val));
        }
Example #47
0
 public string ColumnName16(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.ColumnName16(dbStatement.InternalStmt, index);
 }
Example #48
0
        public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_text16(internalStmt.StmtPtr, index, val, n, free));
        }
Example #49
0
 public ColType ColumnType(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return (ColType)SQLite3.ColumnType(dbStatement.InternalStmt, index);
 }
Example #50
0
        public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_bind_blob(internalStmt.StmtPtr, index, val, n, free));
        }
Example #51
0
 public int BindDouble(IDbStatement stmt, int index, double val)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindDouble(dbStatement.InternalStmt, index, val);
 }
Example #52
0
        public int ColumnCount(IDbStatement stmt)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_column_count(internalStmt.StmtPtr));
        }
Example #53
0
 public bool Equals(IDbStatement other)
 {
     return (other is DbStatement) && ((DbStatement)other).InternalStmt == InternalStmt;
 }
Example #54
0
        public string ColumnName16(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.ColumnName16(internalStmt.StmtPtr, index));
        }
Example #55
0
 public int BindNull(IDbStatement stmt, int index)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindNull(dbStatement.InternalStmt, index);
 }
Example #56
0
        public ColType ColumnType(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_column_type(internalStmt.StmtPtr, index));
        }
Example #57
0
 public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free)
 {
     var dbStatement = (DbStatement)stmt;
     return SQLite3.BindText(dbStatement.InternalStmt, index, val, n, free);
 }
Example #58
0
        public long ColumnInt64(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiOSXInternal.sqlite3_column_int64(internalStmt.StmtPtr, index));
        }
 protected override void OnPersistCommit(IDbStatement cmd, CommitAttempt attempt)
 {
     _raisedCommand = cmd;
     _raisedCommitAttempt = attempt;
 }
        public long ColumnInt64(IDbStatement stmt, int index)
        {
            var dbStatement = (DbStatement)stmt;

            return(SQLite3.ColumnInt64(dbStatement.InternalStmt, index));
        }