Exemple #1
0
        public bool createStream(Item item)
        {
            SqlBoxQuery query = new SqlBoxQuery();

            if (item.UsesAutoId)
            {
                query.Append("CREATE TABLE %table%(%pk% int IDENTITY(1,1) PRIMARY KEY CLUSTERED%fields%)");
            }
            else
            {
                query.Append("CREATE TABLE %table%(%pk% int PRIMARY KEY CLUSTERED%fields%)");
            }
            string       val    = ", %name% varchar(255) DEFAULT NULL";
            string       strA   = item.getIdField();
            StringTheory theory = new StringTheory();

            foreach (string str3 in item.getBoxView().Keys)
            {
                if (string.Compare(strA, str3, true) != 0)
                {
                    theory.Append(val);
                    theory.Replace("%name%", str3);
                }
            }
            query.Replace("%table%", item.getStreamName());
            query.Replace("%pk%", strA);
            query.Replace("%fields%", theory);
            Console.WriteLine(query);
            this.SqlDatabase.process(query);
            return(this.streamExists(item));
        }
Exemple #2
0
        public bool streamExists(string streamName)
        {
            ArrayList   results = new ArrayList();
            SqlBoxQuery query   = new SqlBoxQuery();

            query.Append("SELECT * FROM information_schema.tables WHERE TABLE_NAME = '%StreamName%'");
            query.Replace("%StreamName%", streamName);
            this.SqlDatabase.process(query, results);
            return(results.Count > 0);
        }