Ejemplo n.º 1
0
        public bool MoveNext()
        {
            if (disposed)
            {
                ThrowHelper.ThrowObjectDisposedException(this.GetType().FullName);
            }

            if (mustReset)
            {
                return(false);
            }

            int rc = raw.sqlite3_step(this.sqlite3_stmt);

            if (rc == raw.SQLITE_DONE)
            {
                mustReset = true;
                return(false);
            }
            else if (rc == raw.SQLITE_ROW)
            {
                return(true);
            }
            else
            {
                SQLiteException.CheckOk(this.sqlite3_stmt, rc);
                // Never gets returned
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void BindZeroBlob(int size)
        {
            Contract.Requires(size >= 0);

            int rc = raw.sqlite3_bind_zeroblob(stmt, index + 1, size);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 3
0
        public void Bind(string text)
        {
            Contract.Requires(text != null);

            int rc = raw.sqlite3_bind_text(stmt, index + 1, text);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 4
0
        public void Bind(byte[] blob)
        {
            Contract.Requires(blob != null);

            int rc = raw.sqlite3_bind_blob(stmt, index + 1, blob);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 5
0
 private static void CheckOkOrThrowIOException(int rc)
 {
     try
     {
         SQLiteException.CheckOk(rc);
     }
     catch (SQLiteException e)
     {
         ThrowHelper.ThrowIOException("Received SQLiteException", e);
     }
 }
Ejemplo n.º 6
0
        public void ClearBindings()
        {
            if (disposed)
            {
                ThrowHelper.ThrowObjectDisposedException(this.GetType().FullName);
            }

            int rc = raw.sqlite3_clear_bindings(this.sqlite3_stmt);

            SQLiteException.CheckOk(this.sqlite3_stmt, rc);
        }
Ejemplo n.º 7
0
        public void Reset()
        {
            if (disposed)
            {
                ThrowHelper.ThrowObjectDisposedException(this.GetType().FullName);
            }

            // FIXME: Ignore the result code?
            // If the most recent call to sqlite3_step(S) for the prepared statement S
            // returned SQLITE_ROW or SQLITE_DONE, or if sqlite3_step(S) has never before been
            // called on S, then sqlite3_reset(S) returns SQLITE_OK.
            // If the most recent call to sqlite3_step(S) for the prepared statement S indicated an
            // error, then sqlite3_reset(S) returns an appropriate error code.

            mustReset = false;
            int rc = raw.sqlite3_reset(this.sqlite3_stmt);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 8
0
        public bool Step(int nPages)
        {
            if (disposed)
            {
                ThrowHelper.ThrowObjectDisposedException(this.GetType().FullName);
            }

            int rc = raw.sqlite3_backup_step(backup, nPages);

            if (rc == raw.SQLITE_OK)
            {
                return(true);
            }
            else if (rc == raw.SQLITE_DONE)
            {
                return(false);
            }
            else
            {
                SQLiteException.CheckOk(rc);
                // Never happens, exception always thrown.
                return(false);
            }
        }
Ejemplo n.º 9
0
        public void BindNull()
        {
            int rc = raw.sqlite3_bind_null(stmt, index + 1);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 10
0
        public void Bind(long val)
        {
            int rc = raw.sqlite3_bind_int64(stmt, index + 1, val);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 11
0
        public void Bind(double val)
        {
            int rc = raw.sqlite3_bind_double(stmt, index + 1, val);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 12
0
        public void Bind(ReadOnlySpan <byte> blob)
        {
            int rc = raw.sqlite3_bind_blob(stmt, index + 1, blob);

            SQLiteException.CheckOk(stmt, rc);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Retrieve runtime status information about the
        /// performance of SQLite, and optionally to reset various highwater marks.
        /// </summary>
        /// <seealso href="https://www.sqlite.org/c3ref/status.html"/>
        /// <param name="statusCode">The specific parameter to measure.</param>
        /// <param name="current">The current value of the performance metric.</param>
        /// <param name="highwater">The highwater value of the performance metric.</param>
        /// <param name="reset">If <see langword="true"/>, then the highest record value is reset.</param>
        public static void Status(SQLiteStatusCode statusCode, out int current, out int highwater, bool reset)
        {
            int rc = raw.sqlite3_status((int)statusCode, out current, out highwater, reset ? 1 : 0);

            SQLiteException.CheckOk(rc);
        }