hasTable method
Check is a given tableName
exists.
Implementation
@override
Future<bool> hasTable(TableName tableName) async {
String schema = tableName.getSchema();
String sql = """SELECT count(table_name) FROM INFORMATION_SCHEMA.TABLES
WHERE (TABLE_TYPE='BASE TABLE' or TABLE_TYPE='VIEW' or TABLE_TYPE='EXTERNAL')
and table_schema=?
and upper(table_name) = upper(?)
""";
var res = await select(sql, [schema, tableName.name]);
if (res != null && res.length == 1) {
var row = res.first;
var count = row.getAt(0);
return count == 1;
}
return false;
}