Ejemplo n.º 1
0
        internal override DBSchema GetSchema()
        {
            Dictionary <string, DBTable> Tables = new Dictionary <string, DBTable>();

            if (conn == null || conn.State != ConnectionState.Open)
            {
                OpenDB();
            }

            // Exclude System Tables
            string[] restrictionValues = new string[4];
            restrictionValues[3] = "Table";

            DataTable TableList = conn.GetSchema("Tables", restrictionValues);

            foreach (DataRow dr in TableList.Rows)
            {
                DBTable dbt = new DBTable()
                {
                    Name = dr["TABLE_NAME"].ToString()
                };
                Tables.Add(dbt.Name, dbt);
            }

            DBSchema schema = new DBSchema();

            schema.Tables = Tables;
            CloseDB();
            return(schema);
        }
Ejemplo n.º 2
0
        internal override DBSchema GetSchema()
        {
            Dictionary <string, DBTable> Tables = new Dictionary <string, DBTable>();

            if (conn == null || conn.State != ConnectionState.Open)
            {
                OpenDB();
            }

            IDbCommand cmd = (IDbCommand)assMySql.CreateInstance(MySqlCommandClass, true);

            cmd.Connection  = conn;
            cmd.CommandText = string.Format("SELECT table_name FROM information_schema.tables where table_schema='{0}'", DatabaseName);
            IDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                DBTable dbt = new DBTable()
                {
                    Name = dr["table_name"].ToString()
                };
                Tables.Add(dbt.Name, dbt);
            }
            dr.Close();


            DBSchema schema = new DBSchema();

            schema.Tables = Tables;
            CloseDB();
            return(schema);
        }
        internal override DBSchema GetSchema()
        {
            Dictionary <string, DBTable> Tables = new Dictionary <string, DBTable>();

            if (conn == null || conn.State != ConnectionState.Open)
            {
                OpenDB();
            }

            SqlCommand cmd = new SqlCommand
            {
                Connection  = conn,
                CommandText = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"
            };
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                DBTable dbt = new DBTable()
                {
                    Name = dr["TABLE_NAME"].ToString()
                };
                Tables.Add(dbt.Name, dbt);
            }

            DBSchema schema = new DBSchema
            {
                Tables = Tables
            };

            CloseDB();
            return(schema);
        }
Ejemplo n.º 4
0
        internal override DBSchema GetSchema()
        {
            Dictionary <string, DBTable> Tables = new Dictionary <string, DBTable>();

            Dictionary <string, TableLayout> SQLiteTables = DataAccess.GetTables(DatabaseName);

            foreach (var table in SQLiteTables)
            {
                if (!Common.IsSystemTable(table.Key))
                {
                    DBTable dbt = new DBTable()
                    {
                        Name = table.Key
                    };
                    Tables.Add(dbt.Name, dbt);
                }
            }

            DBSchema schema = new DBSchema();

            schema.Tables = Tables;
            return(schema);
        }
Ejemplo n.º 5
0
        internal override DBSchema GetSchema()
        {
            DataTable dt;
            Dictionary <string, DBTable> Tables = new Dictionary <string, DBTable>();

            if (conn == null || conn.State != ConnectionState.Open)
            {
                OpenDB();
            }

            dt = conn.GetSchema("Tables");

            foreach (DataRow dr in dt.Rows)
            {
                DBTable dbt = new DBTable()
                {
                    Name = dr["TABLE_NAME"].ToString()
                };
                Tables.Add(dbt.Name, dbt);
            }

            /*  Hold off on views for the time being
             * dt = conn.GetSchema("Views");
             *
             * foreach (DataRow dr in dt.Rows)
             * {
             *  DBTable dbt = new DBTable() { Name = dr["TABLE_NAME"].ToString() };
             *  Tables.Add(dbt.Name, dbt);
             * }
             */

            DBSchema schema = new DBSchema();

            schema.Tables = Tables;
            CloseDB();
            return(schema);
        }