示例#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 UpdateSqlSection(Database db, QueryTable table)
        {
            //Check.Require(db != null, "db could not be null.");
            //Check.Require(table != null, "table could not be null.");

            this.db        = db;
            this.tableName = table.TableName;
        }
示例#3
0
 public static QueryColumn All(QueryTable table)
 {
     if (table == null)
     {
         return(new QueryColumn("*", DbType.Int32));
     }
     return(new QueryColumn(string.Format("[{0}].*", table.TableAlias), DbType.Int32));
 }
示例#4
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);
 }
示例#5
0
 public DeleteSqlSection(Database db, QueryTable table)
 {
     this.db        = db;
     this.tableName = table.TableName;
 }
示例#6
0
 public SelectSqlSection RightJoin(QueryTable joinTable, WhereClip joinOnWhere)
 {
     return(RightJoin(joinTable, joinTable.TableAlias, joinOnWhere));
 }