public void UpdateDbTableTree(TreeView db_tree_list) { this.db_tree_list = db_tree_list; ChangePanel(Panel_TableList); TreeNode db_node; if (db_tree_list.SelectedNode.Parent == null) { db_node = db_tree_list.SelectedNode; } else { db_node = db_tree_list.SelectedNode.Parent; } using (MySqlDataReader reader = DB.Read("SELECT `TABLE_NAME`,`ENGINE`,`TABLE_ROWS`,`TABLE_COLLATION` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='" + db_node.Text + "'")) { db_node.Nodes.Clear(); while (reader.Read()) { string table_name = reader.GetString(0); db_node.Nodes.Add(new TreeNode(table_name) { ImageIndex = 1 }); Panel_TableList.AddRow(table_name, reader.GetString(3), reader.GetString(1), reader.GetString(2)); } db_node.Expand(); } }
public void UpdateProcedureList() { table_procedure.Clear(); using (MySqlDataReader reader = DB.Read("SHOW PROCEDURE STATUS WHERE `Db`='" + DB.Database + "'")) { while (reader.Read()) { AddRow(reader.GetString(1), reader.GetString(2)); } } }
public void UpdateTriggerList() { table_trigger.Clear(); using (MySqlDataReader reader = DB.Read("SHOW TRIGGERS FROM `" + DB.Database + "`")) { if (reader == null) { return; } while (reader.Read()) { AddRow(reader.GetString(0), reader.GetString(4), reader.GetString(1)); } } }
private void UpdateDBTree() { using (MySqlDataReader reader = DB.Read("SHOW DATABASES")) { db_tree_list.Nodes.Clear(); while (reader.Read()) { string db_name = reader.GetString(0); if (db_name == "information_schema") { continue; } db_tree_list.Nodes.Add(db_name); } } }
private void FormTrigger_Load(object sender, EventArgs e) { using (MySqlDataReader reader = DB.Read("SHOW TABLES")) { if (!reader.HasRows) { Logger.Error("В выбранной базе данных нет таблиц"); Close(); return; } while (reader.Read()) { trig_table.Items.Add(reader.GetString(0)); } } trig_table.SelectedIndex = 0; trig_time.SelectedIndex = 0; trig_event.SelectedIndex = 0; }
public void ReadIntoTable(string query, string table_name) { ReadIntoTable(query); using (MySqlDataReader reader = DB.Read("SELECT `COLUMN_NAME`,`COLUMN_COMMENT` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = '" + DB.Database + "' AND `TABLE_NAME` = '" + table_name + "'")) { while (reader.Read()) { string column_name = reader.GetString(0); string column_comment = reader.GetString(1); if (column_comment == "") { continue; } for (int i = 0; i < table_query_result.Columns.Count; i++) { if (table_query_result.Columns[i].Name == column_name) { table_query_result.Columns[i].HeaderText = column_comment; break; } } } } }