private void click_run(object sender, EventArgs e) { string sql = "CALL `" + ((Label)table_procedure[(int)((Button)sender).Tag][0]).Text + "`"; SqlQueryStatus result = DB.ReadIntoCache(sql); if (result != SqlQueryStatus.Error) { if (result == SqlQueryStatus.Ok) { OnProcedureRun?.Invoke(); } Logger.Log(sql); } else { Logger.Error("Ошибка запроса"); Logger.Log(DB.Error); } }
private void button_sql_execute_Click(object sender, EventArgs e) { if (sql_input.Text == "") { Logger.Warning("Поле запроса не может быть пустым"); return; } SqlQueryStatus result = DB.ReadIntoCache(sql_input.Text); if (result != SqlQueryStatus.Error) { if (result == SqlQueryStatus.Ok) { OnQuery?.Invoke(); } Logger.Log(sql_input.Text); } else { Logger.Error("Ошибка запроса"); Logger.Log(DB.Error); } }
private void button_search_Click(object sender, EventArgs e) { if (db_tree_list.SelectedNode.Parent == null) { Logger.Info("Пока не арбайтен"); } else { if (search_input.Text == "") { ChangePanel(Panel_TableData); Panel_TableData.ReadIntoTable("SELECT * FROM `" + db_tree_list.SelectedNode.Text + "`", db_tree_list.SelectedNode.Text); return; } string sql = "SELECT * FROM `" + db_tree_list.SelectedNode.Text + "` WHERE "; using (MySqlDataReader reader = DB.Read( "SELECT `COLUMN_NAME`" + "FROM `information_schema`.`COLUMNS`" + "WHERE `TABLE_SCHEMA` = '" + DB.Database + "' AND `TABLE_NAME` = '" + db_tree_list.SelectedNode.Text + "'" )) { while (reader.Read()) { string column_name = reader.GetString(0); sql += "`" + column_name + "` LIKE '%" + search_input.Text + "%' OR"; } if (reader.HasRows) { sql = sql.Remove(sql.Length - 3); } } SqlQueryStatus result = DB.ReadIntoCache(sql); ChangePanel(Panel_TableData); Panel_TableData.ReadIntoTable(); } }
public void ReadIntoTable(string query) { DB.ReadIntoCache(query); ReadIntoTable(); }