listTablesNamesImpl method

  1. @override
Future<List<String>> listTablesNamesImpl(
  1. PostgreSQLConnectionWrapper connection
)
override

Lists the names of the database tables, with connection.

Implemented by the adapters that introspect their schema (see findRelationshipTables). Default: throws UnsupportedError (an adapter that doesn't introspect a database, e.g. DBSQLMemoryAdapter, never calls it).

Implementation

@override
Future<List<String>> listTablesNamesImpl(
  PostgreSQLConnectionWrapper connection,
) async {
  var sql = '''
  SELECT table_name FROM information_schema.tables WHERE table_schema='public'
  ''';

  var results = await connection.mappedResultsQuery(sql);

  var names = results.map((e) => e.values.first).map((e) => '$e').toList();

  return names;
}