MySql.Data.MySqlClient.SchemaProvider.GetForeignKeyColumns C# (CSharp) Method

GetForeignKeyColumns() public method

public GetForeignKeyColumns ( string restrictions ) : DataTable
restrictions string
return System.Data.DataTable
        public virtual DataTable GetForeignKeyColumns(string[] restrictions)
        {
            DataTable dt = new DataTable("Foreign Keys");
            dt.Columns.Add("CONSTRAINT_CATALOG", typeof(string));
            dt.Columns.Add("CONSTRAINT_SCHEMA", typeof(string));
            dt.Columns.Add("CONSTRAINT_NAME", typeof(string));
            dt.Columns.Add("TABLE_CATALOG", typeof(string));
            dt.Columns.Add("TABLE_SCHEMA", typeof(string));
            dt.Columns.Add("TABLE_NAME", typeof(string));
            dt.Columns.Add("COLUMN_NAME", typeof(string));
            dt.Columns.Add("ORDINAL_POSITION", typeof(int));
            dt.Columns.Add("REFERENCED_TABLE_CATALOG", typeof(string));
            dt.Columns.Add("REFERENCED_TABLE_SCHEMA", typeof(string));
            dt.Columns.Add("REFERENCED_TABLE_NAME", typeof(string));
            dt.Columns.Add("REFERENCED_COLUMN_NAME", typeof(string));

            // first we use our restrictions to get a list of tables that should be
            // consulted.  We save the keyname restriction since GetTables doesn't 
            // understand that.
            string keyName = null;
            if (restrictions != null && restrictions.Length >= 4)
            {
                keyName = restrictions[3];
                restrictions[3] = null;
            }

            DataTable tables = GetTables(restrictions);

            // now for each table retrieved, we call our helper function to
            // parse it's foreign keys
            foreach (DataRow table in tables.Rows)
                GetForeignKeysOnTable(dt, table, keyName, true); 
            return dt;
        }