toSQL<T extends SqlType> method
Generates the SQL for this custom field with optional alias.
Returns the field SQL with "AS alias" if an alias is provided, otherwise just the field SQL.
Example:
QSelectCustom(QSelect('name'), as: 'full_name').toSQL(); // "`name` AS `full_name`"
QSelectCustom(QMath('COUNT(*)')).toSQL(); // "COUNT(*)"
Implementation
@override
String toSQL<T extends SqlType>() {
return as.isNotEmpty
? '${field.toSQL<T>()} AS ${QField(as).toSQL<T>()}'
: field.toSQL<T>();
}