BuildSchemaTableInfoTableNames() static private méthode

static private BuildSchemaTableInfoTableNames ( string columnNameArray ) : void
columnNameArray string
Résultat void
Exemple #1
0
        private void BuildSchemaInfo()
        {
            int count = _reader.FieldCount;

            string[] fieldnames = new string[count];
            for (int i = 0; i < count; ++i)
            {
                fieldnames[i] = _reader.GetName(i);
            }
            ADP.BuildSchemaTableInfoTableNames(fieldnames);

            SchemaInfo[]         si    = new SchemaInfo[count];
            PropertyDescriptor[] props = new PropertyDescriptor[_reader.FieldCount];
            for (int i = 0; i < si.Length; i++)
            {
                SchemaInfo s = default;
                s.name     = _reader.GetName(i);
                s.type     = _reader.GetFieldType(i);
                s.typeName = _reader.GetDataTypeName(i);
                props[i]   = new DbColumnDescriptor(i, fieldnames[i], s.type);
                si[i]      = s;
            }

            _schemaInfo      = si;
            _fieldNameLookup = new FieldNameLookup(_reader, -1);
            _descriptors     = new PropertyDescriptorCollection(props);
        }
        private void BuildSchemaInfo()
        {
            int fieldCount = this._reader.FieldCount;

            string[] columnNameArray = new string[fieldCount];
            for (int i = 0; i < fieldCount; i++)
            {
                columnNameArray[i] = this._reader.GetName(i);
            }
            ADP.BuildSchemaTableInfoTableNames(columnNameArray);
            SchemaInfo[]         infoArray  = new SchemaInfo[fieldCount];
            PropertyDescriptor[] properties = new PropertyDescriptor[this._reader.FieldCount];
            for (int j = 0; j < infoArray.Length; j++)
            {
                SchemaInfo info = new SchemaInfo {
                    name     = this._reader.GetName(j),
                    type     = this._reader.GetFieldType(j),
                    typeName = this._reader.GetDataTypeName(j)
                };
                properties[j] = new DbColumnDescriptor(j, columnNameArray[j], info.type);
                infoArray[j]  = info;
            }
            this._schemaInfo      = infoArray;
            this._fieldNameLookup = new FieldNameLookup(this._reader, -1);
            this._descriptors     = new PropertyDescriptorCollection(properties);
        }
 private void GenerateFieldNames(int count)
 {
     this.fieldNames = new string[count];
     for (int i = 0; i < count; ++i)
     {
         fieldNames[i] = this.dataReader.GetName(i);
     }
     ADP.BuildSchemaTableInfoTableNames(fieldNames);
 }
Exemple #4
0
        private void BuildSchemaInfo()
        {
            int count = _reader.FieldCount;

            string[] fieldnames = new string[count];
            for (int i = 0; i < count; ++i)
            {
                fieldnames[i] = _reader.GetName(i);
            }
            ADP.BuildSchemaTableInfoTableNames(fieldnames);

            SchemaInfo[] si = new SchemaInfo[count];
            for (int i = 0; i < si.Length; i++)
            {
                SchemaInfo s = new SchemaInfo();
                s.name     = _reader.GetName(i);
                s.type     = _reader.GetFieldType(i);
                s.typeName = _reader.GetDataTypeName(i);
                si[i]      = s;
            }

            _schemaInfo      = si;
            _fieldNameLookup = new FieldNameLookup(_reader, -1);
        }
        private void BuildCache(bool closeConnection)
        {
            IDbCommand srcCommand = SourceCommand;

            if (null == srcCommand)
            {
                throw ADP.MissingSourceCommand();
            }

            IDbConnection connection = srcCommand.Connection;

            if (null == connection)
            {
                throw ADP.MissingSourceCommandConnection();
            }

            if (null != DataAdapter)
            {
                this.missingMapping = DataAdapter.MissingMappingAction;
                if (MissingMappingAction.Passthrough != missingMapping)
                {
                    missingMapping = MissingMappingAction.Error;
                }
            }

            if (null == this.dbSchemaTable)
            {
                if (0 == (ConnectionState.Open & connection.State))
                {
                    connection.Open();
                }
                else
                {
                    closeConnection = false; // MDAC 58710
                }
                try {                        // try-filter-finally so and catch-throw
                    try {
                        DataTable schemaTable = null;
                        using (IDataReader dataReader = srcCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo)) {
                            schemaTable = dataReader.GetSchemaTable();
                        }

                        if (null != schemaTable)
                        {
#if DEBUG
                            if (AdapterSwitches.OleDbSql.TraceVerbose)
                            {
                                ADP.TraceDataTable("CommandBuilder", schemaTable);
                            }
#endif
                            BuildInformation(schemaTable);
                            this.dbSchemaTable = schemaTable;

                            int count = this.dbSchemaRows.Length;
                            sourceColumnNames = new string[count];
                            for (int i = 0; i < count; ++i)
                            {
                                if (null != dbSchemaRows[i])
                                {
                                    sourceColumnNames[i] = dbSchemaRows[i].ColumnName;
                                }
                            }
                            ADP.BuildSchemaTableInfoTableNames(sourceColumnNames);
                        }
                        else   // MDAC 66620
                        {
                            throw ADP.DynamicSQLNoTableInfo();
                        }
                    }
                    finally { // Close
                        if (closeConnection)
                        {
                            connection.Close();
                        }
                    }
                }
                catch { // MDAC 80973
                    throw;
                }
            }
        }