示例#1
0
        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
        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
        protected void AppendSortSpecification(StringTheory spec, Item entity)
        {
            ArrayList coll = entity.getSortList();

            if (coll.Count > 0)
            {
                spec.Append(" ORDER BY ");
                spec.Join(coll, ", ");
            }
        }
 public void testJoin()
 {
     string str = "foo.foo.foo.foo.foo";
     StringTheory theory = new StringTheory();
     string[] strArray = new string[] { "foo", "foo", "foo", "foo", "foo" };
     theory.Join(strArray, '.');
     Assert.True(str.Equals(theory.ToString()), "1) Joined string doesn't match comparison");
     theory = new StringTheory();
     ArrayList list = new ArrayList();
     list.Add("foo");
     list.Add("foo");
     list.Add("foo");
     list.Add("foo");
     list.Add("foo");
     theory.Join(list, '.');
     Assert.True(str.Equals(theory.ToString()), "2) Joined string doesn't match comparison");
 }