コード例 #1
0
        /// <summary>
        /// Creates a new DBSchemaTable for a returned GetSchema DbTable definition
        /// </summary>
        #region protected virtual DBSchemaTable CreateSchemaTable(TableMappingClass mapping, DataRow tblRow)

        /// <param name="tblRow"></param>
        /// <returns></returns>
        protected virtual DBSchemaTable CreateSchemaTable(TableMappingClass mapping, DataRow tblRow)
        {
            DBSchemaTable sTbl = new DBSchemaTable();

            DataColumn col = GetColumn(tblRow.Table, mapping.TableCatalogColumn, false);

            sTbl.Catalog = this.GetColumnValue(tblRow, col);

            col         = GetColumn(tblRow.Table, mapping.TableSchemaColumn, false);
            sTbl.Schema = this.GetColumnValue(tblRow, col);

            col       = GetColumn(tblRow.Table, mapping.TableNameColumn, false);
            sTbl.Name = this.GetColumnValue(tblRow, col);

            return(sTbl);
        }
コード例 #2
0
        //
        // protected implementation
        //

        /// <summary>
        /// Loads a complete schema for the specified Table schema reference including all columns, and indexes.
        /// </summary>
        #region protected virtual DBSchemaTable LoadATable(DbConnection con, DBSchemaItemRef forRef)

        /// <param name="con"></param>
        /// <param name="forRef"></param>
        /// <returns></returns>
        protected virtual DBSchemaTable LoadATable(DbConnection con, DBSchemaItemRef forRef)
        {
            DBSchemaTable sTbl    = null;
            string        catalog = string.IsNullOrEmpty(forRef.Catalog) ? null : forRef.Catalog;
            string        schema  = string.IsNullOrEmpty(forRef.Schema) ? null : forRef.Schema;

            DataTable tbl     = con.GetSchema(SchemaTablesName, new string[] { catalog, schema, forRef.Name, null });
            DataTable columns = con.GetSchema(SchemaColumnsName, new string[] { catalog, schema, forRef.Name, null });

            if (tbl.Rows.Count > 0)
            {
                DataRow                 tblRow        = tbl.Rows[0];
                TableMappingClass       tblmapping    = this.GetTableMapping();
                TableColumnMappingClass tblcolmapping = this.GetTableColumnMapping();

                sTbl = CreateSchemaTable(tblmapping, tblRow);

                FillTableColumns(sTbl, tblcolmapping, columns);
            }


            return(sTbl);
        }