selectAll method

Future<List<Map<String, dynamic>>> selectAll({
  1. required String sql,
  2. List parameters = const [],
  3. bool inlineBlobs = true,
  4. FbTransaction? inTransaction,
})

Utility method - selects all rows and reurns then as a list of maps.

This method is a shortcut to obtaining a query, opening a cursor on the query with the given SQL statement, and fetching all rows into a list. The rows inside the list are maps, with keys corresponding to column names, and values being the actual column values in each row. A FbQuery object is created internally and closed automatically when the query completes and all rows are fetched. The parameters are the same as in FbQuery.openCursor. Keep in mind, that all rows are cached in the memory, so for queries returning large data sets, the memory consumption can be significant.

Implementation

Future<List<Map<String, dynamic>>> selectAll({
  required String sql,
  List<dynamic> parameters = const [],
  bool inlineBlobs = true,
  FbTransaction? inTransaction,
}) async {
  final q = query();

  try {
    await q.openCursor(
      sql: sql,
      parameters: parameters,
      inlineBlobs: inlineBlobs,
      inTransaction: inTransaction,
    );
    return await q.fetchAllAsMaps();
  } finally {
    await q.close();
  }
}