Skip to content

Commit

Permalink
Merge pull request #1058 from veronikalaskova/turn-off-defense-in-ffi
Browse files Browse the repository at this point in the history
turn off defense in ffi to allow modifying table sqlite_master
  • Loading branch information
alextekartik authored Nov 16, 2023
2 parents 3a91273 + fb176a4 commit ffbffeb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ class SqfliteFfiDatabase {

Future<void> _handleExecute({required String sql, List? sqlArguments}) async {
logSql(sql: sql, sqlArguments: sqlArguments);

if (sql == "PRAGMA sqflite -- db_config_defensive_off") {
final int SQLITE_DBCONFIG_DEFENSIVE = 1010;
_ffiDb.config.setIntConfig(SQLITE_DBCONFIG_DEFENSIVE, 0);
}

if (sqlArguments?.isNotEmpty ?? false) {
// devPrint('execute $sql $sqlArguments');
var preparedStatement = _ffiDb.prepare(sql);
Expand Down

0 comments on commit ffbffeb

Please sign in to comment.