tableWithAlias property

String get tableWithAlias

The table name, optionally suffixed with the alias if one exists. This can be used in select statements, as it returns something like "users u" for a table called users that has been aliased as "u".

Implementation

String get tableWithAlias {
  var dialect = attachedDatabase.executor.dialect;
  var entityNameEscaped = dialect.escape(entityName);
  var aliasedNameEscaped = dialect.escape(aliasedName);
  if (aliasedName == entityName) {
    return entityNameEscaped;
  } else {
    return '$entityNameEscaped $aliasedNameEscaped';
  }
}