Example #1
0
        private void GetNextStatement(IntPtr pzStart, out IntPtr pzTail, out IntPtr pStmt)
        {
            if (parent_conn.Version == 3)
            {
                SqliteError err = Sqlite.sqlite3_prepare16(parent_conn.Handle, pzStart, -1, out pStmt, out pzTail);
                if (err != SqliteError.OK)
                {
                    throw new SqliteSyntaxException(GetError3());
                }
            }
            else
            {
                IntPtr      errMsg;
                SqliteError err = Sqlite.sqlite_compile(parent_conn.Handle, pzStart, out pzTail, out pStmt, out errMsg);

                if (err != SqliteError.OK)
                {
                    string msg = "unknown error";
                    if (errMsg != IntPtr.Zero)
                    {
                        msg = Marshal.PtrToStringAnsi(errMsg);
                        Sqlite.sqliteFree(errMsg);
                    }
                    throw new SqliteSyntaxException(msg);
                }
            }
        }