示例#1
0
        /// <summary>
        /// Returns a DataTable that describes the column metadata of the DBase file.
        /// </summary>
        /// <returns>A DataTable that describes the column metadata.</returns>
        internal DataTable GetSchemaTable()
        {
            DataTable schema = ProviderSchemaHelper.CreateSchemaTable();

            foreach (KeyValuePair <String, DbaseField> entry in _dbaseColumns)
            {
                DataRow    r      = schema.NewRow();
                DbaseField column = entry.Value;
                r[ProviderSchemaHelper.ColumnNameColumn]       = entry.Key;
                r[ProviderSchemaHelper.ColumnSizeColumn]       = column.Length;
                r[ProviderSchemaHelper.ColumnOrdinalColumn]    = column.Ordinal;
                r[ProviderSchemaHelper.NumericPrecisionColumn] = column.Decimals;
                r[ProviderSchemaHelper.NumericScaleColumn]     = 0;
                r[ProviderSchemaHelper.DataTypeColumn]         = column.DataType;
                r[ProviderSchemaHelper.AllowDBNullColumn]      = true;
                r[ProviderSchemaHelper.IsReadOnlyColumn]       = true;
                r[ProviderSchemaHelper.IsUniqueColumn]         = false;
                r[ProviderSchemaHelper.IsRowVersionColumn]     = false;
                r[ProviderSchemaHelper.IsKeyColumn]            = false;
                r[ProviderSchemaHelper.IsAutoIncrementColumn]  = false;
                r[ProviderSchemaHelper.IsLongColumn]           = false;

                // specializations, if ID is unique
                //if (_ColumnNames[i] == "ID")
                //	r["IsUnique"] = true;

                schema.Rows.Add(r);
            }

            return(schema);
        }
示例#2
0
 internal static DataTable DeriveSchemaTable(FeatureDataTable model)
 {
     // UNDONE: the precision computation delegate should not be null
     return(ProviderSchemaHelper.DeriveSchemaTable(model, getLengthByHeuristic, null, null));
 }