diff --git a/drift/CHANGELOG.md b/drift/CHANGELOG.md index 3c5f617b..bee920dd 100644 --- a/drift/CHANGELOG.md +++ b/drift/CHANGELOG.md @@ -3,9 +3,6 @@ - Add the `from(table)` method to generated databases. It can be used to write common queries more concisely. - Make `groupConcat` nullable in the Dart API. -- Throw an exception in a `NativeDatabase` when multiple statements are run in - a single call. In previous versions, parts of the SQL string would otherwise - be ignored. ## 1.2.0 diff --git a/drift/lib/src/ffi/database.dart b/drift/lib/src/ffi/database.dart index 686487bb..5e95aa6b 100644 --- a/drift/lib/src/ffi/database.dart +++ b/drift/lib/src/ffi/database.dart @@ -182,8 +182,7 @@ class _VmDelegate extends DatabaseDelegate { @override Future runBatched(BatchedStatements statements) async { final prepared = [ - for (final stmt in statements.statements) - _db.prepare(stmt, checkNoTail: true), + for (final stmt in statements.statements) _db.prepare(stmt), ]; for (final application in statements.arguments) { @@ -203,7 +202,7 @@ class _VmDelegate extends DatabaseDelegate { if (args.isEmpty) { _db.execute(statement); } else { - final stmt = _db.prepare(statement, checkNoTail: true); + final stmt = _db.prepare(statement); stmt.execute(args); stmt.dispose(); } @@ -228,7 +227,7 @@ class _VmDelegate extends DatabaseDelegate { @override Future runSelect(String statement, List args) async { - final stmt = _db.prepare(statement, checkNoTail: true); + final stmt = _db.prepare(statement); final result = stmt.select(args); stmt.dispose(); diff --git a/drift/lib/src/runtime/api/connection_user.dart b/drift/lib/src/runtime/api/connection_user.dart index e40272fc..d2fa4dfc 100644 --- a/drift/lib/src/runtime/api/connection_user.dart +++ b/drift/lib/src/runtime/api/connection_user.dart @@ -386,10 +386,6 @@ abstract class DatabaseConnectionUser { } /// Executes the custom sql [statement] on the database. - /// - /// [statement] should contain exactly one SQL statement. Attempting to run - /// multiple statements with a single [customStatement] may not be fully - /// supported on all platforms. Future customStatement(String statement, [List? args]) { final engine = resolvedEngine; diff --git a/drift/test/ffi/vm_database_test.dart b/drift/test/ffi/vm_database_test.dart index 04647f45..722707bb 100644 --- a/drift/test/ffi/vm_database_test.dart +++ b/drift/test/ffi/vm_database_test.dart @@ -25,40 +25,6 @@ void main() { underlying.dispose(); }); }); - - group('checks for trailing statement content', () { - late NativeDatabase db; - - setUp(() async { - db = NativeDatabase.memory(); - await db.ensureOpen(_FakeExecutorUser()); - }); - - tearDown(() => db.close()); - - test('multiple statements are allowed for runCustom without args', () { - return db.runCustom('SELECT 1; SELECT 2;'); - }); - - test('throws for runCustom with args', () async { - expect(db.runCustom('SELECT ?; SELECT ?;', [1, 2]), throwsArgumentError); - }); - - test('in runSelect', () async { - expect(db.runSelect('SELECT ?; SELECT ?;', [1, 2]), throwsArgumentError); - }); - - test('in runBatched', () { - expect( - db.runBatched(BatchedStatements([ - 'SELECT ?; SELECT ?;' - ], [ - ArgumentsForBatchedStatement(0, []), - ])), - throwsArgumentError, - ); - }); - }); } class _FakeExecutorUser extends QueryExecutorUser {