tableExists method
Checks if a table exists in the database.
Implementation
Future<Result<bool>> tableExists(String tableName) async {
final sanitizedName = _sanitize(tableName);
String query;
switch (driver.type) {
case DatabaseType.sybaseAnywhere:
query = "SELECT 1 FROM SYS.SYSTABLE WHERE table_name = '$sanitizedName' AND table_type = 'BASE'";
break;
case DatabaseType.sqlServer:
case DatabaseType.postgresql:
query = "SELECT 1 FROM information_schema.tables WHERE table_name = '$sanitizedName' AND table_type = 'BASE TABLE'";
break;
}
return _checkExists(query);
}