exec method
Implementation
Future<Map<String, Object?>> exec(String sql) async {
final id = _nextId++;
_socket.write('${jsonEncode({'id': id, 'sql': sql})}\n');
if (!await _lines.moveNext()) {
throw StateError('connection closed');
}
final reply = jsonDecode(_lines.current) as Map<String, Object?>;
if (reply['ok'] != true) {
throw StateError(reply['error']?.toString() ?? 'unknown error');
}
// Reverse the BLOB sentinel encoding applied by QueryResult.toJson so
// callers see real Uint8List values for BLOB columns.
final rows = reply['rows'];
if (rows is List) {
reply['rows'] = rows
.map((r) => (r as List).map((v) => jsonValueToStorage(v)).toList())
.toList();
}
return reply;
}