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

            //if (parent_conn.Version == 3)
            //{
            err = (SQLiteError)Sqlite3.sqlite3_step(pStmt);

            if (err == SQLiteError.ERROR)
            {
                throw new SQLiteExecutionException(parent_conn.Handle2.errCode, GetError3() + "\n" + pStmt.zErrMsg);
            }

            pazValue   = IntPtr.Zero;
            pazColName = IntPtr.Zero;             // not used for v=3
            cols       = Sqlite3.sqlite3_column_count(pStmt);

            /*
             * }
             * else
             * {
             * err = (SqliteError)Sqlite3.sqlite3_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();
            }
            if (err == SQLiteError.CONSTRAINT)
            {
                throw new SQLiteException(parent_conn.Handle2.errCode, GetError3() + "\n" + pStmt.zErrMsg);
            }
            if (err == SQLiteError.MISMATCH)
            {
                throw new SQLiteException(parent_conn.Handle2.errCode, GetError3() + "\n" + pStmt.zErrMsg);
            }
            // err is either ROW or DONE.
            return(err == SQLiteError.ROW);
        }