Example #1
0
 public void WhereEnsure(bool append_and_if_not_empty)
 {
     if (Where == null)
     {
         Where = new whereclause();
     }
     if (Where.expressions == null)
     {
         Where.expressions = new expressionlist();
     }
     /* [dlatikay 20091215] bugfix */
     if (append_and_if_not_empty)
     {
         if (Where.expressions.Count > 0)
         {
             /* [dlatikay 20091215] bugfix on top: don't prefix AND if expression list already ends with AND */
             if (!Where.expressions[Where.expressions.Count - 1].Equals(shortcuts.where_and))
             {
                 /* [dlatikay 20091215] and one more: tricky... must suffix, not prefix of course - was wrong: .Insert(0, ...)
                  * [dlatikay 20170830] the existing clause can contain a naked OR, therefore we need to bracketize */
                 Where.expressions.Insert(0, shortcuts.where_bracketopen);
                 Where.expressions.Add(shortcuts.where_bracketclose);
                 Where.expressions.Add(shortcuts.where_and);
             }
         }
     }
 }
Example #2
0
 public selectstatement(int top, bool distinct, selectlist fields, tableexpressions tables, joinstatements joins, whereclause where)
 {
     Top      = top;
     Distinct = distinct;
     Fields   = fields;
     Tables   = tables;
     Joins    = joins;
     Where    = where;
 }
Example #3
0
 public selectstatement(int top, bool distinct, selectlist fields, tableexpressions tables, joinstatements joins, whereclause where, groupbystatement group, whereclause having, orderbystatement order)
 {
     Top      = top;
     Distinct = distinct;
     Fields   = fields;
     Tables   = tables;
     Joins    = joins;
     Where    = where;
     GroupBy  = group;
     Having   = having;
     OrderBy  = order;
 }
Example #4
0
 public plainselect_update(selectlist fields, string table, whereclause where)
 {
     Top      = 0;
     Distinct = false;
     Tables   = new tableexpressions()
     {
         new tableexpression(table)
     };
     Joins   = null;
     Where   = where;
     GroupBy = null;
     Having  = null;
     OrderBy = null;
     Fields  = fields;
 }
Example #5
0
 public updateselect(ddl db, Fields fields)
 {
     Top      = 0;
     Distinct = false;
     Tables   = null;
     Joins    = null;
     Where    = new whereclause(fields.PKQueryExpression(db));
     GroupBy  = null;
     Having   = null;
     OrderBy  = null;
     Fields   = new selectlist();
     foreach (Field f in fields)
     {
         if (!f.PrimaryKeyConstituent)
         {
             Fields.Add(new selectparam(db.MakeParamName(f.Name), f.Name, f.Type, f.Size));
         }
     }
 }
Example #6
0
 public plainselect_where(string[] fields, string table, whereclause where)
 {
     Top      = 0;
     Distinct = false;
     Tables   = new tableexpressions()
     {
         new tableexpression(table)
     };
     Joins   = null;
     Where   = where;
     GroupBy = null;
     Having  = null;
     OrderBy = null;
     Fields  = new selectlist();
     foreach (string f in fields)
     {
         Fields.Add(new selectfield(f));
     }
 }
Example #7
0
 public selectstatement(selectlist fields, tableexpressions tables, joinstatements joins, whereclause where)
     : this(0, false, fields, tables, joins, where, null, null, null)
 {
     //Top = 0;
     //Distinct = false;
     //Fields = fields;
     //Tables = tables;
     //Joins = joins;
     //Where = where;
     //GroupBy = null;
     //Having = null;
     //OrderBy = null;
 }
Example #8
0
 public selectstatement(selectlist fields, tableexpressions tables, joinstatements joins, whereclause where, groupbystatement group, whereclause having, orderbystatement order)
     : this(0, false, fields, tables, joins, where, group, having, order)
 {
     //Top = 0;
     //Distinct = false;
     //Fields = fields;
     //Tables = tables;
     //Joins = joins;
     //Where = where;
     //GroupBy = group;
     //Having = having;
     //OrderBy = order;
 }
Example #9
0
 public insertselect(selectlist fields, tableexpressions tables, joinstatements joins, whereclause where)
     : base(fields, tables, joins, where)
 {
 }
Example #10
0
 public insertselect(selectlist fields, tableexpressions tables, joinstatements joins, whereclause where, groupbystatement group, whereclause having, orderbystatement order)
     : base(fields, tables, joins, where, group, having, order)
 {
 }
Example #11
0
 public insertselect(int top, bool distinct, selectlist fields, tableexpressions tables, joinstatements joins, whereclause where)
     : base(top, distinct, fields, tables, joins, where)
 {
 }
Example #12
0
 public insertselect(int top, bool distinct, selectlist fields, tableexpressions tables, joinstatements joins, whereclause where, groupbystatement group, whereclause having, orderbystatement order)
     : base(top, distinct, fields, tables, joins, where, group, having, order)
 {
 }
Example #13
0
 public plainselect_where(string[] fields, Type table, whereclause where) : this(fields, table.Name, where)
 {
 }