private string TryFormatAsFunctionReference(FunctionReference functionReference) { if (ReferenceEquals(functionReference, null)) return null; var sqlName = _functionNameConverter.ConvertToSqlName(functionReference.Name); return functionReference.GetAlias() == null ? string.Format("{0}({1}{2})", sqlName, FormatColumnClause(functionReference.Argument), FormatAdditionalArguments(functionReference.AdditionalArguments)) : string.Format("{0}({1}) AS {2}", sqlName, FormatColumnClause(functionReference.Argument), _schema.QuoteObjectName(functionReference.GetAlias())); }
private string TryFormatAsFunctionReference(FunctionReference functionReference, bool excludeAlias) { if (ReferenceEquals(functionReference, null)) { return(null); } var sqlName = _functionNameConverter.ConvertToSqlName(functionReference.Name); string formatted; if (sqlName.Equals("countdistinct", StringComparison.OrdinalIgnoreCase)) { formatted = string.Format("count(distinct {0})", FormatColumnClause(functionReference.Argument)); } else { formatted = string.Format("{0}({1}{2})", sqlName, FormatColumnClause(functionReference.Argument), FormatAdditionalArguments(functionReference.AdditionalArguments)); } if ((!excludeAlias) && functionReference.GetAlias() != null) { formatted = string.Format("{0} AS {1}", formatted, _schema.QuoteObjectName(functionReference.GetAlias())); } return(formatted); }
private string TryFormatAsFunctionReference(FunctionReference functionReference, bool excludeAlias) { if (ReferenceEquals(functionReference, null)) { return(null); } var sqlName = _functionNameConverter.ConvertToSqlName(functionReference.Name); if (excludeAlias || functionReference.GetAlias() == null) { return(string.Format("{0}({1}{2})", sqlName, FormatColumnClause(functionReference.Argument), FormatAdditionalArguments(functionReference.AdditionalArguments))); } return(string.Format("{0}({1}{2}) AS {3}", sqlName, FormatColumnClause(functionReference.Argument), FormatAdditionalArguments(functionReference.AdditionalArguments), _schema.QuoteObjectName(functionReference.GetAlias()))); }
private string TryFormatAsFunctionReference(FunctionReference functionReference, bool excludeAlias) { if (ReferenceEquals(functionReference, null)) return null; var sqlName = _functionNameConverter.ConvertToSqlName(functionReference.Name); string formatted; if (sqlName.Equals("countdistinct", StringComparison.OrdinalIgnoreCase)) { formatted = string.Format("count(distinct {0})", FormatColumnClause(functionReference.Argument)); } else { formatted = string.Format("{0}({1}{2})", sqlName, FormatColumnClause(functionReference.Argument), FormatAdditionalArguments(functionReference.AdditionalArguments)); } if ((!excludeAlias) && functionReference.GetAlias() != null) { formatted = string.Format("{0} AS {1}", formatted, _schema.QuoteObjectName(functionReference.GetAlias())); } return formatted; }