public IEnumerable <ITreeNode> GetChildren(bool refresh) { var folder = DataCommanderApplication.Instance.ApplicationData.CurrentType; var key = _schema.SchemasNode.Connection.DataSource + "." + _schema.Name; var contains = folder.Attributes.TryGetAttributeValue(key, out string[] tables); if (!contains || refresh) { var commandText = "select table_name from all_tables where owner = '{0}' order by table_name"; commandText = string.Format(commandText, _schema.Name); var command = new OracleCommand(commandText, _schema.SchemasNode.Connection); command.FetchSize = 256 * 1024; var dataTable = command.ExecuteDataTable(CancellationToken.None); var count = dataTable.Rows.Count; tables = new string[count]; for (var i = 0; i < count; i++) { var name = (string)dataTable.Rows[i][0]; tables[i] = name; } folder.Attributes.SetAttributeValue(key, tables); } var treeNodes = new ITreeNode[tables.Length]; for (var i = 0; i < tables.Length; i++) { treeNodes[i] = new TableNode(_schema, tables[i], false); } return(treeNodes); }
public IEnumerable <ITreeNode> GetChildren(bool refresh) { string commandText = "select index_name from sys.all_indexes where owner = '{0}' and table_name = '{1}' order by index_name"; commandText = string.Format(commandText, table.Schema.Name, table.Name); OracleCommand command = new OracleCommand(commandText, table.Schema.SchemasNode.Connection); command.FetchSize = 256 * 1024; DataTable dataTable = command.ExecuteDataTable(); int count = dataTable.Rows.Count; string[] indexes = new string[count]; for (int i = 0; i < count; i++) { string name = (string)dataTable.Rows[i][0]; indexes[i] = name; } ITreeNode[] treeNodes = new ITreeNode[indexes.Length]; for (int i = 0; i < indexes.Length; i++) { treeNodes[i] = new IndexNode(table, indexes[i]); } return(treeNodes); }
public IEnumerable <ITreeNode> GetChildren(bool refresh) { var commandText = "select index_name from sys.all_indexes where owner = '{0}' and table_name = '{1}' order by index_name"; commandText = string.Format(commandText, _table.Schema.Name, _table.Name); var command = new OracleCommand(commandText, _table.Schema.SchemasNode.Connection); command.FetchSize = 256 * 1024; var dataTable = command.ExecuteDataTable(CancellationToken.None); var count = dataTable.Rows.Count; var indexes = new string[count]; for (var i = 0; i < count; i++) { var name = (string)dataTable.Rows[i][0]; indexes[i] = name; } var treeNodes = new ITreeNode[indexes.Length]; for (var i = 0; i < indexes.Length; i++) { treeNodes[i] = new IndexNode(_table, indexes[i]); } return(treeNodes); }