internal void Execute(string content) { SQLStatementParser parser = new SQLStatementParser(); CreateDAQDB(); using(StringReader sr = new StringReader(content)) { this.connectionString = new DBConnectionString().ToString(); this.conn = new MySqlConnection(this.connectionString); this.conn.Open(); MySqlCommand cmd = this.conn.CreateCommand(); if (cmd != null) { Console.WriteLine("DB Connected"); } string line = sr.ReadLine(); while (line != null) { string statement = parser.Add(line); if (statement.Length > 0) { if (statement.StartsWith("/*") && statement.EndsWith("*/")) { } else { string log = string.Format("Execute SQL: {0}", statement); Console.WriteLine(log); this.ExecuteSQL(cmd, statement); } } line = sr.ReadLine(); } } }
internal void Execute(string content) { SQLStatementParser parser = new SQLStatementParser(); CreateDAQDB(); using (StringReader sr = new StringReader(content)) { this.connectionString = new DBConnectionString().ToString(); this.conn = new MySqlConnection(this.connectionString); this.conn.Open(); MySqlCommand cmd = this.conn.CreateCommand(); if (cmd != null) { Console.WriteLine("DB Connected"); } string line = sr.ReadLine(); while (line != null) { string statement = parser.Add(line); if (statement.Length > 0) { if (statement.StartsWith("/*") && statement.EndsWith("*/")) { } else { string log = string.Format("Execute SQL: {0}", statement); Console.WriteLine(log); this.ExecuteSQL(cmd, statement); } } line = sr.ReadLine(); } } }