mappedResultsQuery abstract method

Future<List<Map<String, Map<String, dynamic>>>> mappedResultsQuery(
  1. String fmtString, {
  2. Map<String, dynamic>? substitutionValues,
  3. bool? allowReuse,
  4. int? timeoutInSeconds,
})

Executes a query on this connection and returns each row as a Map.

This method constructs and executes a query in the same way as query, but returns each row as a Map.

(Note: this method will execute additional queries to resolve table names the first time a table is encountered. These table names are cached per instance of this type.)

Each row map contains key-value pairs for every table in the query. The value is a Map that contains key-value pairs for each column from that table. For example, consider the following query:

    SELECT employee.id, employee.name FROM employee;

This method would return the following structure:

    [
      {"employee" : {"name": "Bob", "id": 1}}
    ]

The purpose of this nested structure is to disambiguate columns that have the same name in different tables. For example, consider a query with a SQL JOIN:

    SELECT employee.id, employee.name, company.name FROM employee LEFT OUTER JOIN company ON employee.company_id=company.id;

Each returned Map would contain employee and company keys. The name key would be present in both inner maps.

  [
    {
      "employee": {"name": "Bob", "id": 1},
      "company: {"name": "stable|kernel"}
    }
  ]

Implementation

Future<List<Map<String, Map<String, dynamic>>>> mappedResultsQuery(
    String fmtString,
    {Map<String, dynamic>? substitutionValues,
    bool? allowReuse,
    int? timeoutInSeconds});