Exemple #1
0
        // Executes a statement and returns whether there is more data available.
        internal bool ExecuteStatement(IntPtr pStmt, out int cols, out IntPtr pazValue, out IntPtr pazColName)
        {
            SqliteError err;

            if (parent_conn.Version == 3)
            {
                err = Sqlite.sqlite3_step(pStmt);
                if (err == SqliteError.ERROR)
                {
                    throw new SqliteExecutionException(GetError3());
                }
                pazValue = IntPtr.Zero; pazColName = IntPtr.Zero;                 // not used for v=3
                cols     = Sqlite.sqlite3_column_count(pStmt);
            }
            else
            {
                err = Sqlite.sqlite_step(pStmt, out cols, out pazValue, out pazColName);
                if (err == SqliteError.ERROR)
                {
                    throw new SqliteExecutionException();
                }
            }

            if (err == SqliteError.BUSY)
            {
                throw new SqliteBusyException();
            }

            if (err == SqliteError.MISUSE)
            {
                throw new SqliteExecutionException();
            }

            // err is either ROW or DONE.
            return(err == SqliteError.ROW);
        }