private void InitForeignKeys(IDataBaseSchema meta)
 {
     foreach (DataRow row in meta.GetForeignKeys(catalog, schema, name).Rows)
     {
         AddForeignKey(row, meta);
     }
 }
示例#2
0
 /// <summary>
 /// Inicializa os indices da instancia.
 /// </summary>
 /// <param name="meta"></param>
 private void InitIndexes(IDataBaseSchema meta)
 {
     foreach (System.Data.DataRow row in meta.GetIndexInfo(_catalog, _schema, _name).Rows)
     {
         AddIndex(row, meta);
     }
 }
 private void InitIndexes(IDataBaseSchema meta)
 {
     foreach (DataRow row in meta.GetIndexInfo(catalog, schema, name).Rows)
     {
         AddIndex(row, meta);
     }
 }
示例#4
0
 /// <summary>
 /// Inicializa as colunas da instancia.
 /// </summary>
 /// <param name="meta"></param>
 private void InitColumns(IDataBaseSchema meta)
 {
     foreach (System.Data.DataRow row in meta.GetColumns(_catalog, _schema, _name, null).Rows)
     {
         AddColumn(row);
     }
 }
示例#5
0
 /// <summary>
 /// Inicializa as chaves estrangeiras da instancia.
 /// </summary>
 /// <param name="meta"></param>
 private void InitForeignKeys(IDataBaseSchema meta)
 {
     foreach (System.Data.DataRow row in meta.GetForeignKeys(_catalog, _schema, _name).Rows)
     {
         AddForeignKey(row, meta);
     }
 }
 private void InitColumns(IDataBaseSchema meta)
 {
     foreach (DataRow row in meta.GetColumns(catalog, schema, name, null).Rows)
     {
         AddColumn(row);
     }
 }
		public DatabaseMetadata(DbConnection connection, Dialect.Dialect dialect, bool extras)
		{
			meta = dialect.GetDataBaseSchema(connection);
		    this.dialect = dialect;
		    this.extras = extras;
			InitSequences(connection, dialect);
			sqlExceptionConverter = dialect.BuildSQLExceptionConverter();
		}
示例#8
0
 public DatabaseMetadata(DbConnection connection, Dialect.Dialect dialect, bool extras)
 {
     meta         = dialect.GetDataBaseSchema(connection);
     this.dialect = dialect;
     this.extras  = extras;
     InitSequences(connection, dialect);
     sqlExceptionConverter = dialect.BuildSQLExceptionConverter();
 }
示例#9
0
 public BaseTableMetadata(System.Data.DataRow rs, IDataBaseSchema meta, bool extras)
 {
     this.ParseTableInfo(rs);
     this.InitColumns(meta);
     if (extras)
     {
         this.InitForeignKeys(meta);
         this.InitIndexes(meta);
     }
 }
示例#10
0
 public static TableEnumerator GetInstance(IDataBaseSchema schema)
 {
     if (null == Configuration)
     {
         throw new InvalidOperationException("Configuration not initialized");
     }
     if (null == instance)
     {
         instance = new TableEnumerator();
     }
     instance.Schema = schema;
     return(instance);
 }
		public AbstractTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras)
		{
			ParseTableInfo(rs);
			InitColumns(meta);
			if (extras)
			{
				InitForeignKeys(meta);
				InitIndexes(meta);
			}
			string cat = catalog == null ? "" : catalog + '.';
			string schem = schema == null ? "" : schema + '.';
			log.Info("table found: " + cat + schem + name);
			log.Info("columns: " + StringHelper.CollectionToString(columns.Keys));
			if (extras)
			{
				log.Info("foreign keys: " + StringHelper.CollectionToString(foreignKeys.Keys));
				log.Info("indexes: " + StringHelper.CollectionToString(indexes.Keys));
			}
		}
        public AbstractTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras)
        {
            ParseTableInfo(rs);
            InitColumns(meta);
            if (extras)
            {
                InitForeignKeys(meta);
                InitIndexes(meta);
            }
            string cat   = catalog == null ? "" : catalog + '.';
            string schem = schema == null ? "" : schema + '.';

            log.Info("table found: " + cat + schem + name);
            log.Info("columns: " + StringHelper.CollectionToString(columns.Keys));
            if (extras)
            {
                log.Info("foreign keys: " + StringHelper.CollectionToString(foreignKeys.Keys));
                log.Info("indexes: " + StringHelper.CollectionToString(indexes.Keys));
            }
        }
示例#13
0
        /// <summary>
        /// Adiciona um indice para a instancia.
        /// </summary>
        /// <param name="rs"></param>
        /// <param name="meta"></param>
        private void AddIndex(System.Data.DataRow rs, IDataBaseSchema meta)
        {
            string index = GetIndexName(rs);

            if (string.IsNullOrEmpty(index))
            {
                return;
            }
            IIndexMetadata info = GetIndexMetadata(index);

            if (info == null)
            {
                info = GetIndexMetadata(rs);
                _indexes[info.Name.ToLowerInvariant()] = info;
            }
            foreach (System.Data.DataRow row in meta.GetIndexColumns(_catalog, _schema, _name, index).Rows)
            {
                info.AddColumn(GetColumnMetadata(GetColumnName(row)));
            }
        }
示例#14
0
        /// <summary>
        /// Adiciona uma chave estrangeira para a instancia.
        /// </summary>
        /// <param name="rs">Linha que contem</param>
        /// <param name="meta"></param>
        private void AddForeignKey(System.Data.DataRow rs, IDataBaseSchema meta)
        {
            string fk = GetConstraintName(rs);

            if (string.IsNullOrEmpty(fk))
            {
                return;
            }
            IForeignKeyMetadata info = GetForeignKeyMetadata(fk);

            if (info == null)
            {
                info = GetForeignKeyMetadata(rs);
                _foreignKeys[info.Name.ToLowerInvariant()] = info;
            }
            foreach (System.Data.DataRow row in meta.GetIndexColumns(_catalog, _schema, _name, fk).Rows)
            {
                info.AddColumn(GetColumnMetadata(GetColumnName(row)));
            }
        }
        private void AddForeignKey(DataRow rs, IDataBaseSchema meta)
        {
            string fk = GetConstraintName(rs);

            if (string.IsNullOrEmpty(fk))
            {
                return;
            }

            IForeignKeyMetadata info = GetForeignKeyMetadata(fk);

            if (info == null)
            {
                info = GetForeignKeyMetadata(rs);
                foreignKeys[info.Name] = info;
            }

            foreach (DataRow row in meta.GetIndexColumns(catalog, schema, name, fk).Rows)
            {
                info.AddColumn(GetColumnMetadata(GetColumnName(row)));
            }
        }
        private void AddIndex(DataRow rs, IDataBaseSchema meta)
        {
            string index = GetIndexName(rs);

            if (string.IsNullOrEmpty(index))
            {
                return;
            }

            IIndexMetadata info = GetIndexMetadata(index);

            if (info == null)
            {
                info = GetIndexMetadata(rs);
                indexes[info.Name] = info;
            }

            foreach (DataRow row in meta.GetIndexColumns(catalog, schema, name, index).Rows)
            {
                info.AddColumn(GetColumnMetadata(GetColumnName(row)));
            }
        }
示例#17
0
        public void InquireSchema()
        {
            Dialect.MsSql2005Dialect dialect = new MsSql2005Dialect();
            DbConnection             conn    = new SqlConnection(@"");

            conn.Open();

            DatabaseMetadata meta = new DatabaseMetadata(conn, dialect);



            IDataBaseSchema schema = dialect.GetDataBaseSchema(conn);
            var             dt     = schema.GetTables(null, null, null, new string[0]);
            var             cols   = schema.GetColumns(null, null, null, null);
            var             keys   = schema.GetForeignKeys(null, null, null);

            foreach (DataRow r in dt.Rows)
            {
                var tableMeta = schema.GetTableMetadata(r, true);
                Console.WriteLine(string.Format("Table {2}:[{0}].[{1}]", tableMeta.Schema, tableMeta.Name, tableMeta.Catalog));
                ITableMetadata  tm  = meta.GetTableMetadata(tableMeta.Name, tableMeta.Schema, tableMeta.Catalog, false);
                IColumnMetadata col = tm.GetColumnMetadata(cols.Rows[0].ItemArray[2] as string);
            }
        }
示例#18
0
 public MsSqlTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras)
 {
 }
示例#19
0
 public ChillowMySqlTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras)
     : base(rs, meta, extras)
 {
 }
示例#20
0
 public PostgreSQLTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras)
 {
 }
		public PostgreSQLTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras) { }
示例#22
0
 public SybaseAnywhereTableMetaData(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras)
 {
 }
示例#23
0
		public FirebirdTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras) { }
示例#24
0
		public SQLiteTableMetaData(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras) {}
		public SybaseAnywhereTableMetaData(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras) {}
		private void AddForeignKey(DataRow rs, IDataBaseSchema meta)
		{
			string fk = GetConstraintName(rs);

			if (string.IsNullOrEmpty(fk))
				return;

			IForeignKeyMetadata info = GetForeignKeyMetadata(fk);
			if (info == null)
			{
				info = GetForeignKeyMetadata(rs);
				foreignKeys[info.Name.ToLowerInvariant()] = info;
			}

			foreach (DataRow row in meta.GetIndexColumns(catalog, schema, name, fk).Rows)
			{
				info.AddColumn(GetColumnMetadata(GetColumnName(row)));
			}
		}
示例#27
0
 public FirebirdTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras)
 {
 }
		private void InitColumns(IDataBaseSchema meta)
		{
			foreach (DataRow row in meta.GetColumns(catalog, schema, name, null).Rows)
			{
				AddColumn(row);
			}
		}
		private void InitIndexes(IDataBaseSchema meta)
		{
			foreach (DataRow row in meta.GetIndexInfo(catalog, schema, name).Rows)
			{
				AddIndex(row, meta);
			}
		}
		private void InitForeignKeys(IDataBaseSchema meta)
		{
			foreach (DataRow row in meta.GetForeignKeys(catalog, schema, name).Rows)
			{
				AddForeignKey(row, meta);
			}
		}
		public OracleTableMetadata(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras) { }
示例#32
0
 public DB2TableMetaData(DataRow rs, IDataBaseSchema meta, bool extras) : base(rs, meta, extras)
 {
 }
		private void AddIndex(DataRow rs, IDataBaseSchema meta)
		{
			string index = GetIndexName(rs);

			if (string.IsNullOrEmpty(index)) return;

			IIndexMetadata info = GetIndexMetadata(index);
			if (info == null)
			{
				info = GetIndexMetadata(rs);
				indexes[info.Name.ToLowerInvariant()] = info;
			}

			foreach (DataRow row in meta.GetIndexColumns(catalog, schema, name, index).Rows)
			{
				info.AddColumn(GetColumnMetadata(GetColumnName(row)));
			}
		}