Beispiel #1
0
        public IDbStatement Prepare2(IDbHandle db, string query)
        {
            var dbHandle = (DbHandle)db;
            var stmt     = default(Sqlite3Statement);

            if (_useWinSqlite)
            {
                var r = WinSQLite3.Prepare2(dbHandle.InternalDbHandle, query, query.Length, out stmt, IntPtr.Zero);
                if (r != Result.OK)
                {
                    throw SQLiteException.New(r, WinSQLite3.GetErrmsg(dbHandle.InternalDbHandle));
                }
            }
            else
            {
                var r = SQLite3.Prepare2(dbHandle.InternalDbHandle, query, query.Length, out stmt, IntPtr.Zero);
                if (r != Result.OK)
                {
                    throw SQLiteException.New(r, SQLite3.GetErrmsg(dbHandle.InternalDbHandle));
                }
            }

            return(new DbStatement(stmt));
        }