mysql1_dart icon indicating copy to clipboard operation
mysql1_dart copied to clipboard

there is the possibility to implement a mappedResultsQuery method just like in the postgres package

Open insinfo opened this issue 4 years ago • 1 comments

there is the possibility to implement a mappedResultsQuery method just like in the postgres package to return rows as maps containing table and column names:

https://pub.dev/packages/postgres

List<Map<String, Map<String, dynamic>>> results = await connection.mappedResultsQuery(
  "SELECT t.id, t.name, u.name FROM t LEFT OUTER JOIN u ON t.id=u.t_id");

for (final row in results) {
  var tID = row["t"]["id"];
  var tName = row["t"]["name"];
  var uName = row["u"]["name"];
}

insinfo avatar Apr 08 '20 16:04 insinfo

Sounds reasonable. Will accept a PR adding this.

adamlofts avatar Apr 10 '20 09:04 adamlofts