Пример #1
0
        public override DbObjectCollection CreateCollection(IConnectionInformation info)
        {
            var collection = new DbObjectCollection(info);
            var con        = collection.Context.Database.Connection;

            if (con.State != System.Data.ConnectionState.Open)
            {
                con.Open();
            }
            collection.DataTypes = new Dictionary <string, DbObjectCollection.DataType>();
            foreach (DataRow row in GetDataTypes().Rows)
            {
                var dt = new DbObjectCollection.DataType(row);
                collection.DataTypes.Add(dt.Name, dt);
            }

            collection.RegisterObjects(con.GetSchema("Tables"), true, "TABLE_SCHEMA NOT IN('information_schema','pg_catalog')");
            collection.RegisterObjects(con.GetSchema("Views"), false, "TABLE_SCHEMA NOT IN('information_schema','pg_catalog')");
            var creator = new DbObjectCollection.ColumnCreator();

            collection.RegisterMembers(con.GetSchema("Columns"), creator);

            collection.RegisterPrimaryKey();

            return(collection);
        }
Пример #2
0
        public override DbObjectCollection CreateCollection(IConnectionInformation info)
        {
            var collection = new DbObjectCollection(info);
            var con        = collection.Initialization();
            var creator    = new DbObjectCollection.ColumnCreator();

            collection.RegisterObjects(con.GetSchema("Tables"), true, "TABLE_TYPE = 'TABLE'");
            collection.RegisterMembers(con.GetSchema("Columns"), creator);

            collection.RegisterPrimaryKey();
            return(collection);
        }
Пример #3
0
        public override DbObjectCollection CreateCollection(IConnectionInformation info)
        {
            var collection = new DbObjectCollection(info);

            collection.Names.DataTypeKey = "NativeDataType";
            var con     = collection.Initialization();
            var table   = con.GetSchema("Tables");
            var creator = new DbObjectCollection.ColumnCreator();
            var rows    = table.AsEnumerable().Where(a => !a.Field <string>("TABLE_NAME").EndsWith("$")).ToArray();

            collection.RegisterObjects(rows, true);
            collection.RegisterMembers(con.GetSchema("Columns"), creator);
            return(collection);
        }
Пример #4
0
        public override DbObjectCollection CreateCollection(IConnectionInformation info)
        {
            var collection = new DbObjectCollection(info);

            collection.Names.DataType = "DATATYPE";
            var con = collection.Initialization();

            collection.RegisterObjects(collection.GetDataTable(
                                           @"SELECT OWNER TABLE_SCHEMA, TABLE_NAME
FROM ALL_TABLES 
WHERE OWNER NOT IN 
('SYS', 'SYSTEM', 'SYSMAN','CTXSYS', 'MDSYS', 'OLAPSYS', 'ORDSYS', 'OUTLN','WKSYS', 'WMSYS', 'XDB', 'ORDPLUGINS')
AND OWNER NOT LIKE 'APEX%'
ORDER BY OWNER, TABLE_NAME"), true);
            collection.RegisterObjects(collection.GetDataTable(
                                           @"SELECT OWNER TABLE_SCHEMA, VIEW_NAME TABLE_NAME
FROM ALL_VIEWS 
WHERE OWNER NOT IN 
('SYS', 'SYSTEM', 'SYSMAN','CTXSYS', 'MDSYS', 'OLAPSYS', 'ORDSYS', 'OUTLN','WKSYS', 'WMSYS', 'XDB', 'ORDPLUGINS')
AND OWNER NOT LIKE 'APEX%'
ORDER BY OWNER, VIEW_NAME"), false);
            var creator = new DbObjectCollection.ColumnCreator();

            creator.Names.TrueValue = "Y";
            creator.Names.CharName  = "";
            collection.RegisterMembers(collection.GetDataTable(
                                           @"SELECT OWNER TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_ID AS ID, DATA_TYPE AS DataType, 
DATA_LENGTH AS CHARACTER_MAXIMUM_LENGTH, DATA_PRECISION AS NUMERIC_PRECISION, DATA_SCALE AS NUMERIC_SCALE, 
NULLABLE AS IS_NULLABLE, CHAR_USED, CHAR_LENGTH AS LengthInChars 
FROM ALL_TAB_COLUMNS WHERE OWNER NOT IN 
('SYS', 'SYSTEM', 'SYSMAN','CTXSYS', 'MDSYS', 'OLAPSYS', 'ORDSYS', 'OUTLN','WKSYS', 'WMSYS', 'XDB', 'ORDPLUGINS')
AND OWNER NOT LIKE 'APEX%'
ORDER BY OWNER, TABLE_NAME, ID"), creator);

            var table = collection.GetDataTable(
                @"select  b.OWNER TABLE_SCHEMA,b.TABLE_NAME,b.COLUMN_NAME,b.POSITION ORDINAL_POSITION from all_constraints a
inner join all_cons_columns b ON a.OWNER=b.OWNER and a.CONSTRAINT_NAME=b.CONSTRAINT_NAME
where a.constraint_type='P'");

            collection.RegisterPrimaryKey(table);
            return(collection);
        }
Пример #5
0
        public override DbObjectCollection CreateCollection(IConnectionInformation info)
        {
            var collection = new DbObjectCollection(info);

            collection.Names.DataTypeKey = "NativeDataType";
            var con     = collection.Initialization();
            var creator = new DbObjectCollection.ColumnCreator();

            collection.RegisterObjects(con.GetSchema("Tables"), true, "TABLE_TYPE = 'TABLE'");
            collection.RegisterObjects(con.GetSchema("Views"), false);

            collection.RegisterMembers(con.GetSchema("Columns"), creator);

            var table = con.GetSchema("Indexes");

            var rows = table.Select("PRIMARY_KEY=0");

            foreach (var row in rows)
            {
                table.Rows.Remove(row);
            }
            collection.RegisterPrimaryKey(table);
            return(collection);
        }