Beispiel #1
0
        public Hub()
        {
            sqlg = new SQLiteGate();
            sqlg.Open("Data Source=..\\betterdb.sql;New=True");
            Console.Error.WriteLine("Opening DB...");

            sqlg = new SQLiteGate();
            sqlg.Open("Data Source=..\\betterdb.sql;New=True");

            Console.Error.WriteLine("DB open. Reading script file...");

            StreamReader sr = new StreamReader("..\\init_db.sql");

            string sql = "";

            while (!sr.EndOfStream)
                sql += sr.ReadLine() + "\r\n";

            Console.Error.WriteLine("SQL script rdy. Executing...");

            sqlg.ExecuteNonQuery(sql);

            Console.Error.WriteLine("SQL script done. DB ready for further operations");
        }
Beispiel #2
0
        public void Init()
        {
            Console.Error.WriteLine("Opening DB...");

            sqlg = new SQLiteGate();
            sqlg.Open("Data Source=..\\betterdb.sql;New=True");

            Console.Error.WriteLine("DB open. Reading script file...");

            StreamReader sr = new StreamReader("..\\init_db.sql");

               /* string sql = "DROP VIEW kuponag;" +
                            "DROP VIEW rynek;      " +
                            "DROP TABLE uzytkownik;" +
                            "DROP TABLE wydarzenie;" +
                            "DROP TABLE wynik;     " +
                            "DROP TABLE kupon;     ";*/
            string sql = "";

            while (!sr.EndOfStream)
                sql += sr.ReadLine() + "\r\n";

            Console.Error.WriteLine("SQL script rdy. Executing...");

            sqlg.ExecuteNonQuery(sql);

            Console.Error.WriteLine("SQL script done. DB ready for further operations");
        }