Пример #1
0
        public SelectSqlSection(Database db, QueryTable table, params ExpressionClip[] columns)
        {
            this.db        = db;
            this.tableName = table.TableName;
            string aliasName = table.TableAlias;

            this.whereClip = new WhereClip(new FromClip(this.tableName, string.IsNullOrEmpty(aliasName) ? this.tableName : aliasName));

            if (table is IExpression)
            {
                SqlQueryUtils.AddParameters(this.whereClip.Parameters, table as IExpression);
            }

            if (columns != null && columns.Length > 0)
            {
                this.columnNames = new string[columns.Length];
                for (int i = 0; i < columns.Length; ++i)
                {
                    this.columnNames[i] = columns[i].ToString();

                    //add parameters in column to whereClip
                    if (columns[i].Parameters.Count > 0)
                    {
                        SqlQueryUtils.AddParameters(this.whereClip.Parameters, columns[i]);
                    }
                }
            }
        }
Пример #2
0
 public SelectSqlSection RightJoin(QueryTable joinTable, string joinTableAliasName, WhereClip joinOnWhere)
 {
     this.whereClip.From.RightJoin(joinTable.TableName, joinTableAliasName, joinOnWhere);
     if (joinOnWhere.Parameters.Count > 0)
     {
         SqlQueryUtils.AddParameters(whereClip.Parameters, joinOnWhere);
     }
     return(this);
 }