Exemple #1
0
        override internal void LoadForView()
        {
            MySql5Database  db  = this.View.Database as MySql5Database;
            MySql5Databases dbs = db.Databases as MySql5Databases;

            if (dbs.Version.StartsWith("5"))
            {
                string query = @"SHOW COLUMNS FROM `" + this.View.Name + "`";

                DataTable     metaData = new DataTable();
                DbDataAdapter adapter  = MySql5Databases.CreateAdapter(query, this.dbRoot.ConnectionString);

                adapter.Fill(metaData);

                if (metaData.Columns.Contains("Extra"))
                {
                    f_Extra = metaData.Columns["Extra"];
                }

                metaData.Columns["Field"].ColumnName   = "COLUMN_NAME";
                metaData.Columns["Type"].ColumnName    = "DATA_TYPE";
                metaData.Columns["Null"].ColumnName    = "IS_NULLABLE";
                metaData.Columns["Default"].ColumnName = "COLUMN_DEFAULT";

                PopulateArray(metaData);
            }
        }
Exemple #2
0
        internal override void LoadAll()
        {
            try
            {
                string name = "";

                // We add our one and only Database
                using (MySqlConnection conn = new MySqlConnection(this.dbRoot.ConnectionString))
                {
                    conn.Open();
                    name = conn.Database;

                    MySql5Database database = (MySql5Database)this.dbRoot.ClassFactory.CreateDatabase();
                    database._name     = name;
                    database.dbRoot    = this.dbRoot;
                    database.Databases = this;
                    this._array.Add(database);

                    try
                    {
                        DataTable     metaData = new DataTable();
                        DbDataAdapter adapter  = new MySqlDataAdapter("SELECT VERSION()", conn);// MySql5Databases.CreateAdapter("SELECT VERSION()", this.dbRoot.ConnectionString);

                        adapter.Fill(metaData);

                        this.Version = metaData.Rows[0][0] as string;
                    }
                    catch { }
                }
            }
            catch {}
        }
Exemple #3
0
        override internal void LoadAll()
        {
            try
            {
                MySql5Database db = (MySql5Database)this.Table.Database;

                if (!db._FKsInLoad)
                {
                    db._FKsInLoad = true;

                    MySql5ForeignKeys fks = null;

                    foreach (Table table in this.Table.Tables)
                    {
                        fks = table.ForeignKeys as MySql5ForeignKeys;
                    }

                    AddMyHalf();

                    foreach (Table table in this.Table.Tables)
                    {
                        fks = table.ForeignKeys as MySql5ForeignKeys;
                        fks.AddTheOtherHalf();
                    }

                    AddTheOtherHalf();

                    db._FKsInLoad = false;
                }
                else
                {
                    AddMyHalf();
                }
            }
            catch {}
        }