예제 #1
0
        /// <summary>
        /// Creates DataSet with:
        /// <para>“Schema: Tables”</para>
        /// <para>“User: Tables”</para>
        /// <para>“”</para>
        /// </summary>
        /// <returns></returns>
        virtual public DataSet GetTableList(
            bool get_schema_table__tables,
            bool get_schema_table__user_tables,
            bool get_db_names
            )
        {
            DataSet BigTable = new DataSet("Table Listing");

            if (get_schema_table__tables)
            {
                DataTable TableData = this.GetSchemaTable("Tables");
                BigTable.Tables.Add(TableData);
            }
            if (get_schema_table__user_tables)
            {
                DataTable Table2 = new DataTable("User: Tables");
                Table2.Columns.Add("TABLE_SCHEMA", typeof(string));
                Table2.Columns.Add("TABLE_NAME", typeof(string));
                Table2.Columns.Add("AUTO_INCREMENT", typeof(int));
                Table2.Columns.Add("TABLE_COMMENT", typeof(string));
                // builds up some table content
                foreach (DataRow dr in BigTable.Tables["Tables"].Rows)
                {
                    Table2.Rows.Add(dr["TABLE_SCHEMA"], dr["TABLE_NAME"], dr["AUTO_INCREMENT"], dr["TABLE_COMMENT"]);
                }
                Table2.TableName = "User: Tables";
                BigTable.Tables.Add(Table2);
            }
            if (get_db_names)
            {
                DatabaseNames.Clear();
                foreach (DataRow dr in SchemaDatabases.Rows)
                {
                    DatabaseNames.Add(string.Format("{0}", dr["database_name"]));
                }
                foreach (string db in DatabaseNames)
                {
                    DbInfo.Add(db, new DatabaseNfo(this, db));
                }
            }

            InitializeMoreInfo(BigTable);
            return(BigTable);
        }