internal static string GetLastError(SQLiteConnectionHandle hdl, IntPtr db) { if (hdl == null || db == IntPtr.Zero) { return("null connection or database handle"); } string str = null; try { } finally { lock (hdl) { if (hdl.IsInvalid || hdl.IsClosed) { str = "closed or invalid connection handle"; } else { int num = 0; str = SQLiteConvert.UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, ref num), num); } } } GC.KeepAlive(hdl); return(str); }
private int xCreate(int argc, ref IntPtr argv, ref IntPtr ppTokenizer) { try { sqlite3_tokenizer pTokenizer = new sqlite3_tokenizer(); this.ppTokenizer = this.MarshalStruct(pTokenizer); ppTokenizer = this.ppTokenizer; string tokenizerArgument = null; if (argc > 0) { tokenizerArgument = SQLiteConvert.UTF8ToString(argv, -1); } owner.OnCreate(tokenizerArgument); return(SQLITE_OK); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(SQLITE_ERROR); } }
private int xOpen(ref sqlite3_tokenizer pTokenizer, IntPtr pInput, int nBytes, ref IntPtr ppCursor) { try { sqlite3_tokenizer_cursor pCursor = new sqlite3_tokenizer_cursor(); pCursor.pTokenizer = this.ppTokenizer; this.ppCursor = this.MarshalStruct(pCursor); ppCursor = this.ppCursor; owner.inputString = SQLiteConvert.UTF8ToString(pInput, nBytes); owner.tokenNumber = -1; owner.PrepareToStart(); return(SQLITE_OK); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(SQLITE_ERROR); } }
private static void LogCallback(IntPtr pUserData, int errorCode, IntPtr pMessage) { bool flag; SQLiteLogEventHandler sQLiteLogEventHandler; lock (SQLiteLog.syncRoot) { flag = SQLiteLog._enabled; if (SQLiteLog._handlers == null) { sQLiteLogEventHandler = null; } else { sQLiteLogEventHandler = SQLiteLog._handlers.Clone() as SQLiteLogEventHandler; } } if (flag && sQLiteLogEventHandler != null) { sQLiteLogEventHandler(null, new LogEventArgs(pUserData, (object)errorCode, SQLiteConvert.UTF8ToString(pMessage, -1), null)); } }