Exemple #1
0
        protected string buildTag(string fieldname, string Format)
        {
            StringTheory theory = new StringTheory(Format);

            theory.Replace("*", fieldname);
            return(theory.ToString());
        }
Exemple #2
0
        public void Prepend(ICollection list)
        {
            StringTheory str = new StringTheory();

            str.Join(list, "");
            this.Prepend(str);
        }
Exemple #3
0
        public static void main(string[] args)
        {
            StringTheory theory = new StringTheory("StringTheory v%VERSION% (c) 2003 Built Software.\nSee http://www.builtsoftware.com/products/StringTheory/ for more info.");

            theory.Replace("%VERSION%", Version);
            Console.WriteLine(theory);
        }
Exemple #4
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;
 }
Exemple #5
0
 protected override void LimitRecordsReturned(StringTheory query, int limit)
 {
     if (limit > -1)
     {
         query.Prepend(query.CutThru("SELECT") + " TOP " + limit);
     }
 }
Exemple #6
0
 public Field(string name, string value)
 {
     this.Attributes = null;
     this.Name = new StringTheory();
     this.Name.Renew(name);
     base.Renew(value);
 }
Exemple #7
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;
 }
Exemple #8
0
 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);
         }
     }
 }
Exemple #9
0
 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);
 }
Exemple #10
0
        public void StripRange(int start, int count)
        {
            StringTheory theory = new StringTheory(base.Cut(start, count));

            theory.Replace(" ", "");
            theory.Replace("\t", "");
            base.Paste(base.Start(), theory.ToString());
        }
Exemple #11
0
 protected override void LimitRecordsReturned(StringTheory query, int limit)
 {
     if (limit > -1)
     {
         query.Append(" LIMIT ");
         query.Append(limit.ToString());
         query.Append(" ");
     }
 }
Exemple #12
0
 protected void AppendSortSpecification(StringTheory spec, Item entity)
 {
     ArrayList coll = entity.getSortList();
     if (coll.Count > 0)
     {
         spec.Append(" ORDER BY ");
         spec.Join(coll, ", ");
     }
 }
Exemple #13
0
 protected override void LimitRecordsReturned(StringTheory query, int limit)
 {
     if (limit > -1)
     {
         query.Prepend("SELECT * FROM (");
         query.Append(") WHERE rownum < ");
         query.Append((limit + 1).ToString());
         query.Append(" ");
     }
 }
Exemple #14
0
        public void Populate(Hashtable values, string tagFormat)
        {
            StringTheory phrase = new StringTheory();

            foreach (string str in values.Keys)
            {
                phrase.Renew(tagFormat);
                phrase.Replace("*", str);
                this.Replace(phrase, values[str]);
            }
        }
Exemple #15
0
        public void Flip()
        {
            StringTheory theory = new StringTheory(this);

            this.Erase();
            while (!theory.IsEmpty())
            {
                this.Push(theory.Pop());
            }
            this.touch();
        }
Exemple #16
0
 protected void AppendSelectQuery(string tableName, StringTheory conditions, StringTheory specifiers, int limit)
 {
     StringTheory val = new StringTheory("SELECT * FROM %tableName% WHERE %conditions% %specifiers%");
     if (conditions.IsEmpty())
     {
         val.Replace("WHERE ", "");
     }
     val.Replace("%tableName%", tableName);
     val.Replace("%conditions%", conditions);
     val.Replace("%specifiers%", specifiers);
     base.Append(val);
     this.LimitRecordsReturned(this, limit);
 }
Exemple #17
0
 public XmlDocument Describe()
 {
     XmlDocument document = new XmlDocument();
     StringTheory theory = new StringTheory("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
     ArrayList list = new ArrayList();
     theory.Append("<streams>\n");
     this.ListStreams(list);
     foreach (Hashtable hashtable in list)
     {
         theory.Append(this.DescribeStream(hashtable["TABLE_NAME"].ToString()));
     }
     theory.Append("</streams>\n");
     document.LoadXml(theory.ToString());
     return document;
 }
Exemple #18
0
 public string DescribeStream(string stream)
 {
     StringTheory theory = new StringTheory("<stream name=\"%stream%\">\n%fields%</stream>\n");
     StringTheory theory2 = new StringTheory();
     ArrayList list = new ArrayList();
     this.ListColumns(stream, list);
     theory.Replace("%stream%", stream);
     foreach (Hashtable hashtable in list)
     {
         theory2.Append("<field name=\"%COLUMN_NAME%\" type=\"%DATA_TYPE%\" identity=\"%IDENTITY%\"/>\n");
         theory2.Populate(hashtable, "%*%");
         theory2.Replace("%IDENTITY%", this.IsIdentity(hashtable));
     }
     theory.Replace("%fields%", theory2);
     return theory.ToString();
 }
Exemple #19
0
 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);
 }
Exemple #20
0
 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);
     }
 }
Exemple #21
0
 public void Format(string FormatString)
 {
     if (FormatString.Length > 0)
     {
         StringTheory theory  = new StringTheory();
         StringTheory theory2 = new StringTheory(this);
         theory2.Flip();
         for (int i = 0; i < FormatString.Length; i++)
         {
             if (FormatString[i] == '#')
             {
                 theory.Push(theory2.Pop());
             }
             else
             {
                 theory.Push(FormatString[i]);
             }
         }
         base.Renew(theory);
     }
 }
Exemple #22
0
 // Methods
 protected void BuildCondition(StringTheory condition, Item entity)
 {
     Hashtable hashtable = entity.getBoxView();
     Field field = null;
     foreach (string str in hashtable.Keys)
     {
         field = (Field)hashtable[str];
         if (field.Touched())
         {
             if (condition.Length > 0)
             {
                 condition.Append(" AND ");
             }
             if (field.Length < 1)
             {
                 condition.Append(" ( len(" + str + ") < 1 or " + str + " IS NULL ) ");
             }
             else
             {
                 condition.Append(str);
                 condition.Append("=");
                 condition.Append(field.toSql());
             }
         }
         if (field.hasAttributes())
         {
             string[] strArray = field.getAttributes();
             for (int i = 0; i < strArray.Length; i++)
             {
                 if (condition.Length > 0)
                 {
                     condition.Append(" AND ");
                 }
                 condition.Append(str);
                 condition.Append(strArray[i]);
             }
         }
     }
 }
Exemple #23
0
 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);
     }
 }
Exemple #24
0
 public bool BeginsWith(StringTheory phrase)
 {
     return this.BeginsWith(phrase.ToString());
 }
Exemple #25
0
 public void RegisterString(StringTheory hostString)
 {
     this.hostString = hostString;
 }
Exemple #26
0
 public StringTheory(StringTheory initialValue)
 {
     this.init();
     base.textBuffer.Append(initialValue);
 }
Exemple #27
0
 public XmlDocument Describe(string streamName)
 {
     XmlDocument document = new XmlDocument();
     StringTheory theory = new StringTheory("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
     return document;
 }
Exemple #28
0
 public void Prepend(StringTheory str)
 {
     this.Paste(0, str.ToString());
 }
Exemple #29
0
 public void Append(StringTheory val)
 {
     this.Append(val.ToString());
 }
Exemple #30
0
 public void Prepend(StringTheory str)
 {
     this.Paste(0, str.ToString());
 }
Exemple #31
0
 public static void main(string[] args)
 {
     StringTheory theory = new StringTheory("StringTheory v%VERSION% (c) 2003 Built Software.\nSee http://www.builtsoftware.com/products/StringTheory/ for more info.");
     theory.Replace("%VERSION%", Version);
     Console.WriteLine(theory);
 }
Exemple #32
0
 protected string buildTag(string fieldname, string Format)
 {
     StringTheory theory = new StringTheory(Format);
     theory.Replace("*", fieldname);
     return theory.ToString();
 }
Exemple #33
0
 public void StripRange(int start, int count)
 {
     StringTheory theory = new StringTheory(base.Cut(start, count));
     theory.Replace(" ", "");
     theory.Replace("\t", "");
     base.Paste(base.Start(), theory.ToString());
 }
Exemple #34
0
 public void Populate(Hashtable values, string tagFormat)
 {
     StringTheory phrase = new StringTheory();
     foreach (string str in values.Keys)
     {
         phrase.Renew(tagFormat);
         phrase.Replace("*", str);
         this.Replace(phrase, values[str]);
     }
 }
Exemple #35
0
 public StringTheory(StringTheory initialValue)
 {
     this.init();
     base.textBuffer.Append(initialValue);
 }
Exemple #36
0
 public void Format(string FormatString)
 {
     if (FormatString.Length > 0)
     {
         StringTheory theory = new StringTheory();
         StringTheory theory2 = new StringTheory(this);
         theory2.Flip();
         for (int i = 0; i < FormatString.Length; i++)
         {
             if (FormatString[i] == '#')
             {
                 theory.Push(theory2.Pop());
             }
             else
             {
                 theory.Push(FormatString[i]);
             }
         }
         base.Renew(theory);
     }
 }
Exemple #37
0
 public bool Contains(StringTheory phrase)
 {
     return this.Contains(phrase.ToString());
 }
Exemple #38
0
 public void Flip()
 {
     StringTheory theory = new StringTheory(this);
     this.Erase();
     while (!theory.IsEmpty())
     {
         this.Push(theory.Pop());
     }
     this.touch();
 }
Exemple #39
0
 public string getXml()
 {
     StringTheory theory = new StringTheory("<%islandName%>%body%</%islandName%>\n");
     StringTheory val = new StringTheory();
     StringTheory theory3 = new StringTheory();
     foreach (string str in this.getFieldNames())
     {
         val.Renew("    <%fieldName%>%fieldValue%</%fieldName%>\n");
         val.Replace("%fieldName%", str.ToLower());
         val.Replace("%fieldValue%", ((Field)this[str]).getValue());
         theory3.Append(val);
     }
     theory.Replace("%islandName%", this.StreamName.ToLower());
     theory.Replace("%body%", theory3);
     return theory.ToString();
 }
Exemple #40
0
 public void Prepend(ICollection list)
 {
     StringTheory str = new StringTheory();
     str.Join(list, "");
     this.Prepend(str);
 }
Exemple #41
0
 public void Append(StringTheory val)
 {
     this.Append(val.ToString());
 }
Exemple #42
0
 public bool BeginsWith(StringTheory phrase)
 {
     return(this.BeginsWith(phrase.ToString()));
 }
Exemple #43
0
 public bool Contains(StringTheory phrase)
 {
     return(this.Contains(phrase.ToString()));
 }