Beispiel #1
0
        static void Main87(string[] args)
        {
            //TestSelect();
            //TestSelectError();
            string input = "";

            //input = @"SELECT bookId, title, pages, authorId, editorial FROM Book where a = 1;";
            //input = @"SELECT * FROM Book as B Where 1 and 5;";
            input = @"CREATE INDEX IDX_CUSTOMER_LAST_NAME ON Customer (Last_Name, First_Name, Second_Name, haha);";
            input = @"CREATE INDEX ONX_CUSTOMER_LAST_NAME ON Onstomer (Last_Name, First_Name, Second_Name, haha);";

            SqlObjects.SQL_Index index = Parser.Index(input);
            Console.WriteLine(index);
            Console.ReadKey(true);
        }
Beispiel #2
0
 public static KeyValuePair <string, dynamic> sql_selector(string sql)
 {
     string[] seperated_query = sql.Split();
     if (string.Compare(seperated_query[0].ToLower(), "create", true) == 0)
     {
         SqlGrammar.Sql_Table table = CreateTable(sql);
         return(new KeyValuePair <string, dynamic>("create", table));
     }
     else if (string.Compare(seperated_query[0].ToLower(), "insert", true) == 0)
     {
         //Console.WriteLine("Inserting");
         SqlGrammar.Sql_Insertion Insertion = Insert(sql);
         return(new KeyValuePair <string, dynamic>("Inserting", Insertion));
         //public string table;
         //public List<string> AttrNames;
         //public List<dynamic> AttrValues;
     }
     else if (string.Compare(seperated_query[0].ToLower(), "select", true) == 0)
     {
         //Console.WriteLine("Inserting");
         SqlObjects.Sql_Select selection = Parser.Select(sql + ";");
         return(new KeyValuePair <string, dynamic>("select", selection));
         //public string table;
         //public List<string> AttrNames;
         //public List<dynamic> AttrValues;
     }
     else if (string.Compare(seperated_query[0].ToLower(), "create index") == 0)
     {
         SqlObjects.SQL_Index Indexing = Parser.Index(sql);
         return(new KeyValuePair <string, dynamic>("index", Indexing));
     }
     else
     {
         if (sql == string.Empty)
         {
             return(new KeyValuePair <string, dynamic>("empty", null));
         }
         else
         {
             return(new KeyValuePair <string, dynamic>("unKnown", null));
         }
     }
 }