public SQLiteStatement(SQLiteDatabase database, string sql, Func <SQLiteError, SQLiteOnErrorAction> prepareErrorHandler) { if (database == null) { throw new ArgumentNullException(nameof(database)); } if (sql == null) { throw new ArgumentNullException(nameof(sql)); } Database = database; Sql = sql; database.Log(TraceLevel.Verbose, "Preparing statement `" + sql + "`", nameof(SQLiteStatement) + ".ctor"); if (prepareErrorHandler != null) { var code = SQLiteDatabase._sqlite3_prepare16_v2(database.CheckDisposed(), sql, sql.Length * 2, out _handle, IntPtr.Zero); if (code != SQLiteErrorCode.SQLITE_OK) { var error = new SQLiteError(this, -1, code); var action = prepareErrorHandler(error); if (action == SQLiteOnErrorAction.Break || action == SQLiteOnErrorAction.Continue) { return; } database.CheckError(code, sql, true); } } else { database.CheckError(SQLiteDatabase._sqlite3_prepare16_v2(database.CheckDisposed(), sql, sql.Length * 2, out _handle, IntPtr.Zero), sql, true); } }