230 var ignoreCase = context.
Query.IgnoreIdentifiersCase();
233 foreach (var fromTable
in fromClause.AllTables) {
234 var uniqueKey = fromTable.UniqueKey;
235 var alias = fromTable.Alias;
237 if (fromTable.IsSubQuery) {
239 var subQuery = fromTable.SubQuery;
240 var subQueryFrom =
Create(context, subQuery);
243 ObjectName aliasTableName = null;
245 aliasTableName =
new ObjectName(alias);
248 queryFrom.AddTable(
new FromTableSubQuerySource(ignoreCase, uniqueKey, subQuery, subQueryFrom, aliasTableName));
251 string name = fromTable.Name;
254 var tableName = context.
Query.ResolveTableName(name);
256 if (!context.
Query.TableExists(tableName))
257 throw new InvalidOperationException(
String.Format(
"Table '{0}' was not found.", tableName));
259 ObjectName givenName = null;
261 givenName =
new ObjectName(alias);
264 ITableQueryInfo tableQueryInfo = context.
Query.GetTableQueryInfo(tableName, givenName);
266 queryFrom.AddTable(
new FromTableDirectSource(ignoreCase, tableQueryInfo, uniqueKey, givenName, tableName));
274 if (selectColumn.IsGlob) {
276 if (selectColumn.IsAll) {
277 queryFrom.ExposeAllColumns();
280 queryFrom.ExposeColumns(selectColumn.TableName);
291 string alias = selectColumn.Alias;
292 var v = selectColumn.Expression.AsReferenceName();
293 bool aliasMatchV = (v != null && alias != null &&
294 queryFrom.CompareStrings(v.Name, alias));
295 if (alias != null && !aliasMatchV) {
296 queryFrom.AddExpression(
new ExpressionReference(selectColumn.Expression, alias));
297 queryFrom.ExposeColumn(
new ObjectName(alias));
298 }
else if (v != null) {
299 var resolved = queryFrom.ResolveReference(v);
300 queryFrom.ExposeColumn(resolved ?? v);
302 string funName = selectColumn.Expression.ToString();
303 queryFrom.AddExpression(
new ExpressionReference(selectColumn.Expression, funName));
304 queryFrom.ExposeColumn(
new ObjectName(funName));
IEnumerable< SelectColumn > SelectColumns
A long string in the system.
static QueryExpressionFrom Create(IRequest context, SqlQueryExpression expression)