Skip to content

Commit ec96068

Browse files
committed
Updated web database implementation to match native implementation for get/getOptional. Using getAll for refreshSchema
1 parent 0623505 commit ec96068

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/sqlite_async/lib/src/sqlite_queries.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,6 @@ mixin SqliteQueries implements SqliteWriteContext, SqliteConnection {
140140

141141
@override
142142
Future<void> refreshSchema() {
143-
return get("PRAGMA table_info('sqlite_master')");
143+
return getAll("PRAGMA table_info('sqlite_master')");
144144
}
145145
}

packages/sqlite_async/lib/src/web/database.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class _SharedContext implements SqliteReadContext {
150150
@override
151151
Future<Row> get(String sql, [List<Object?> parameters = const []]) async {
152152
final results = await getAll(sql, parameters);
153-
return results.single;
153+
return results.first;
154154
}
155155

156156
@override
@@ -169,7 +169,7 @@ class _SharedContext implements SqliteReadContext {
169169
Future<Row?> getOptional(String sql,
170170
[List<Object?> parameters = const []]) async {
171171
final results = await getAll(sql, parameters);
172-
return results.singleOrNull;
172+
return results.firstOrNull;
173173
}
174174

175175
void markClosed() {

0 commit comments

Comments
 (0)