コード例 #1
0
ファイル: SqlBoxUpdateQuery.cs プロジェクト: built/BoxBoy
 public bool build(Item item)
 {
     Hashtable hashtable = item.getBoxView();
     Field field = (Field)hashtable[item.getIdField()];
     if (!field.IsEmpty())
     {
         Field field2 = null;
         ArrayList coll = new ArrayList();
         foreach (string str in hashtable.Keys)
         {
             field2 = (Field)hashtable[str];
             if (!str.Equals(item.getIdField()) && field2.Touched())
             {
                 coll.Add(str + "=" + field2.toSql());
             }
         }
         if (coll.Count > 0)
         {
             StringTheory theory = new StringTheory();
             theory.Join(coll, ", ");
             StringTheory val = new StringTheory("UPDATE %tableName% SET %pairListing% WHERE %idField% = %id%");
             val.Replace("%tableName%", item.getStreamName());
             val.Replace("%pairListing%", theory);
             val.Replace("%idField%", item.getIdField());
             val.Replace("%id%", field.toSql());
             base.Append(val);
         }
     }
     return false;
 }
コード例 #2
0
ファイル: SqlBoxInsertQuery.cs プロジェクト: built/BoxBoy
 public bool build(Item item)
 {
     StringTheory theory = new StringTheory();
     StringTheory theory2 = new StringTheory();
     Field field = null;
     Hashtable hashtable = item.getBoxView();
     ArrayList coll = new ArrayList();
     ArrayList list2 = new ArrayList();
     foreach (string str in hashtable.Keys)
     {
         field = (Field)hashtable[str];
         if ((field != null) && field.Touched())
         {
             coll.Add(str);
             list2.Add(field.toSql());
         }
     }
     theory.Join(coll, ", ");
     theory2.Join(list2, ", ");
     if (coll.Count > 0)
     {
         StringTheory val = new StringTheory("INSERT INTO %tableName% (%fields%) VALUES (%values%)");
         val.Replace("%tableName%", item.getStreamName());
         val.Replace("%fields%", theory);
         val.Replace("%values%", theory2);
         base.Append(val);
     }
     return false;
 }
コード例 #3
0
ファイル: SqlServerDeleteQuery.cs プロジェクト: built/BoxBoy
 protected override void build(Item item, int limit)
 {
     string val = item.getStreamName();
     string str2 = item.getIdField();
     StringTheory condition = new StringTheory();
     base.BuildCondition(condition, item);
     if (limit > -1)
     {
         StringTheory theory2 = new StringTheory("SELECT TOP %limit% %id_field% FROM %table%");
         theory2.Replace("%limit%", limit);
         theory2.Replace("%id_field%", item.getIdField());
         theory2.Replace("%table%", val);
         if ((condition != null) && (condition.Length > 0))
         {
             theory2.Append(" WHERE ");
             theory2.Append(condition);
         }
         base.Append("DELETE FROM ");
         base.Append(val);
         base.Append(" WHERE ");
         base.Append(string.Concat(new object[] { item.getIdField(), " IN (", theory2, ")" }));
     }
     else
     {
         base.Append("DELETE FROM ");
         base.Append(val);
         if ((condition != null) && (condition.Length > 0))
         {
             base.Append(" WHERE ");
             base.Append(condition);
         }
     }
 }
コード例 #4
0
ファイル: SqlServerFindQuery.cs プロジェクト: built/BoxBoy
 public void build(Item item)
 {
     StringTheory val = new StringTheory("SELECT TOP 1 %idField% FROM %tableName% WHERE %idField% = '%id%'");
     val.Replace("%idField%", item.getIdField());
     val.Replace("%tableName%", item.getStreamName());
     val.Replace("%id%", item.Id);
     base.Append(val);
 }
コード例 #5
0
ファイル: SqlBoxSelectQuery.cs プロジェクト: built/BoxBoy
 public bool build(Item entity, int max)
 {
     base.Erase();
     if (entity != null)
     {
         StringTheory condition = new StringTheory();
         StringTheory spec = new StringTheory();
         base.BuildCondition(condition, entity);
         if (entity.getSortList().Count > 0)
         {
             this.AppendSortSpecification(spec, entity);
         }
         this.AppendSelectQuery(entity.getStreamName(), condition, spec, max);
     }
     return (base.Length > 0);
 }
コード例 #6
0
ファイル: MySqlDeleteQuery.cs プロジェクト: built/BoxBoy
 protected override void build(Item item, int limit)
 {
     string val = item.getStreamName();
     string str2 = item.getIdField();
     StringTheory condition = new StringTheory();
     base.BuildCondition(condition, item);
     base.Append("DELETE FROM ");
     base.Append(val);
     if ((condition != null) && (condition.Length > 0))
     {
         base.Append(" WHERE ");
         base.Append(condition);
     }
     if (limit > -1)
     {
         base.Append(" LIMIT " + limit);
     }
 }
コード例 #7
0
ファイル: OracleDeleteQuery.cs プロジェクト: built/BoxBoy
 protected override void build(Item entity, int limit)
 {
     string str = entity.getStreamName();
     string str2 = entity.getIdField();
     StringTheory condition = new StringTheory();
     base.BuildCondition(condition, entity);
     OracleSelectQuery query = new OracleSelectQuery(entity, -1);
     base.Append("DELETE FROM " + str);
     if (condition.Length > 0)
     {
         base.Append(" WHERE " + condition);
         if (limit > -1)
         {
             base.Append(" AND rownum < ");
             base.Append(limit + 1);
         }
     }
     else if (limit > -1)
     {
         base.Append(" WHERE rownum < ");
         base.Append(limit + 1);
     }
 }