Example #1
0
        void TestR7()
        {
            "Demonstrating Requirement #7".title();

            QE.valueByKey(1, dbPay);                        // Return value by key
            WriteLine();

            QE.childrenByKey(1, dbPay);                     // return children by key

            //QE1.keyPattern(".*h.*", dbString);
            WriteLine();
            QE1.keyPattern(".*hjbbj.*", dbString);          // search by pattern in key name
            WriteLine();
            QE.metaDataPattern("t2", dbString);             // search by string in metadata

            //DateTime toDate = new DateTime(2015, 10, 7);
            DateTime toDate   = new DateTime();                 //Please pass the custom toTime like DateTime toDate = new DateTime(2015, 10, 7);
            DateTime fromDate = new DateTime(2015, 10, 1);

            //System.Threading.Thread.Sleep(500);

            QE.dateTimeSearch(fromDate, toDate, dbString);
        }
        static void Main(string[] args)
        {
            QueryEngine <int, string>    QE  = new QueryEngine <int, string>();
            QueryEngine <string, string> QE1 = new QueryEngine <string, string>();

            DBEngine <int, DBElement <int, List <string> > >       dbPay    = new DBEngine <int, DBElement <int, List <string> > >();
            DBEngine <string, DBElement <string, List <string> > > dbString = new DBEngine <string, DBElement <string, List <string> > >();
            DBElement <string, List <String> > elemString = new DBElement <string, List <String> >(); //Populating DBEngine

            elemString.name      = "Element2";                                                        //object dbString
            elemString.descr     = "testelement2";                                                    //for testing data string and list of string type.
            elemString.timeStamp = DateTime.Now;
            elemString.children.AddRange(new List <string> {
                "SMA1", "Syracuse2", "NY3"
            });
            elemString.payload = new List <string>();
            elemString.payload.AddRange(new List <string> {
                "we", "rock", "the ", "world"
            });
            dbString.insert("Prohject2", elemString);
            DBElement <string, List <String> > elemString2 = new DBElement <string, List <String> >(); //Populating DBEngine

            elemString2.name      = "Element3";                                                        //object dbString
            elemString2.descr     = "test element3";                                                   //for testing data string and list of string type.
            elemString2.timeStamp = DateTime.Now;
            elemString2.children.AddRange(new List <string> {
                "SMA2", "Syracuse22", "NY33"
            });
            elemString2.payload = new List <string>();
            elemString2.payload.AddRange(new List <string> {
                "Thug", "Life"
            });
            dbString.insert("Thug3", elemString2);
            DBElement <int, List <string> > elemPayload = new DBElement <int, List <string> >();    //Populating DBEngine

            elemPayload.name      = "Element4";                                                     //object dbPay
            elemPayload.descr     = "test element4";                                                //for testing data int and list of string type.
            elemPayload.timeStamp = DateTime.Now;
            elemPayload.children.AddRange(new List <int> {
                1, 2, 3
            });
            elemPayload.payload = new List <string>();
            elemPayload.payload.AddRange(new List <string> {
                "Project 2", " ", "demo", " ", "starts"
            });
            dbPay.insert(1, elemPayload);
            DBElement <int, List <string> > elemPayload2 = new DBElement <int, List <string> >();   //Populating DBEngine

            elemPayload2.name      = "Element5";                                                    //object dbPay
            elemPayload2.descr     = "test element5";                                               //for testing data int and list of string type.
            elemPayload2.timeStamp = DateTime.Now;
            elemPayload2.children.AddRange(new List <int> {
                98, 22, 35
            });
            elemPayload2.payload = new List <string>();
            elemPayload2.payload.AddRange(new List <string> {
                "we", "rock", "the", "world"
            });
            dbPay.insert(2, elemPayload2);

            QE.valueByKey(1, dbPay);
            WriteLine();

            QE.childrenByKey(1, dbPay);

            //QE1.keyPattern(".*h.*", dbString);
            WriteLine();
            QE1.keyPattern(".*hjbbj.*", dbString);
            WriteLine();
            QE.metaDataPattern("t2", dbString);

            //DateTime toDate = new DateTime(2015, 10, 7);
            DateTime toDate   = new DateTime(2015, 10, 7);
            DateTime fromDate = new DateTime(2015, 10, 1);

            //System.Threading.Thread.Sleep(500);

            QE.dateTimeSearch(fromDate, toDate, dbString);
        }