Example #1
0
        public void selectEntries(string tableName, string columnName, string op, string value)
        {
            Debug.Assert(tableName != null && tableName.Length > 0, "Empty table name!");
            Debug.Assert(columnName != null && columnName.Length > 0, "Empty column name!");

            Console.WriteLine("Selecting stuff: " + tableName + " " + columnName + " " + op + " " + value);
            dk.LoadDatabase(selectedDatabase, DATABASE_PATH);
            dk.SelectDatabase(selectedDatabase);

            Dictionary <string, List <string> > result = dk.SelectData(tableName, op, value);

            Console.WriteLine("Select result:\n");
            if (result != null)
            {
                foreach (KeyValuePair <string, List <string> > kvp in result)
                {
                    Console.Write("\nKey = {0}, Values: ", kvp.Key);
                    foreach (string val in kvp.Value)
                    {
                        Console.Write(val + " ");
                    }
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                CLIParser.Main2(args);
            }
            else
            {
                //JsonDatabaseKeeper keeper= new JsonDatabaseKeeper();
                TBDatabaseKeeper keeper = new TBDatabaseKeeper();
                DataKeeper       dk     = new DataKeeper(keeper);
                var columns             = new List <string>();
                var ncolumns            = new List <string>();
                var values  = new List <string>();
                var nvalues = new List <string>();
                columns.AddRange(new[] { "Col1", "Col2", "Col3" });
                ncolumns.AddRange(new[] { "Col4", "Col5" });
                values.AddRange(new[] { "a1", "a2", "a3" });
                nvalues.AddRange(new[] { "b1", "b2", "b3" });

                //dk.CreateDatabase("AJsonDB", @"C:\scrap");
                dk.LoadDatabase("AJsonDB", @"C:\scrap");
                dk.SelectDatabase("AJsonDB");

                //dk.CreateTable("MyFirstTable",columns);
                //dk.DeleteTable("MyFirstTable");
                //var table = dk.ReadTable("MyFirstTable");
                //dk.AddEntries("MyFirstTable", "Col1", values);
                //dk.AddColumns("MyFirstTable", ncolumns);
                //dk.UpdateEntry("MyFirstTable","Col1",1,"c2");
                //dk.InsertEntries("MyFirstTable", "Col1",1,nvalues);
                //var columnEntries = dk.ReadColumn("MyFirstTable", "Col1");
                //dk.DeleteColumn("MyFirstTable","Col1");
                dk.DeleteEntries("MyFirstTable", "Col1", 2, 3);

                //Importer.Importer importer= new Importer.Importer();
                //var parsedcsv = importer.ReadCsv(@"C:\scrap\AJsonDB\exampleCSV.csv");
            }
        }