private static OdbcParameter[] DeriveParametersFromStoredProcedure(OdbcConnection connection, OdbcCommand command) { List <OdbcParameter> list = new List <OdbcParameter>(); CMDWrapper statementHandle = command.GetStatementHandle(); OdbcStatementHandle hrHandle = statementHandle.StatementHandle; string leftQuote = connection.QuoteChar("DeriveParameters"); string[] strArray = MultipartIdentifier.ParseMultipartIdentifier(command.CommandText, leftQuote, leftQuote, '.', 4, true, "ODBC_ODBCCommandText", false); if (strArray[3] == null) { strArray[3] = command.CommandText; } ODBC32.RetCode retcode = hrHandle.ProcedureColumns(strArray[1], strArray[2], strArray[3], null); if (retcode != ODBC32.RetCode.SUCCESS) { connection.HandleError(hrHandle, retcode); } using (OdbcDataReader reader = new OdbcDataReader(command, statementHandle, CommandBehavior.Default)) { reader.FirstResult(); int fieldCount = reader.FieldCount; while (reader.Read()) { OdbcParameter item = new OdbcParameter { ParameterName = reader.GetString(3) }; switch (reader.GetInt16(4)) { case 1: item.Direction = ParameterDirection.Input; break; case 2: item.Direction = ParameterDirection.InputOutput; break; case 4: item.Direction = ParameterDirection.Output; break; case 5: item.Direction = ParameterDirection.ReturnValue; break; } item.OdbcType = TypeMap.FromSqlType((ODBC32.SQL_TYPE)reader.GetInt16(5))._odbcType; item.Size = reader.GetInt32(7); switch (item.OdbcType) { case OdbcType.Decimal: case OdbcType.Numeric: item.ScaleInternal = (byte)reader.GetInt16(9); item.PrecisionInternal = (byte)reader.GetInt16(10); break; } list.Add(item); } } retcode = hrHandle.CloseCursor(); return(list.ToArray()); }
// DeriveParametersFromStoredProcedure ( // OdbcConnection connection, // OdbcCommand command); // // Uses SQLProcedureColumns to create an array of OdbcParameters // static private OdbcParameter[] DeriveParametersFromStoredProcedure(OdbcConnection connection, OdbcCommand command) { ArrayList rParams = new ArrayList(); // following call ensures that the command has a statement handle allocated HandleRef hstmt = command.GetStatementHandle(); int cColsAffected; ODBC32.RETCODE retcode; retcode = (ODBC32.RETCODE)UnsafeNativeMethods.Odbc32.SQLProcedureColumnsW( hstmt, null, 0, null, 0, command.CommandText, (Int16)ODBC32.SQL_NTS, null, 0); // Note: the driver does not return an error if the given stored procedure does not exist // therefore we cannot handle that case and just return not parameters. if (ODBC32.RETCODE.SUCCESS != retcode) { connection.HandleError(hstmt, ODBC32.SQL_HANDLE.STMT, retcode); } OdbcDataReader reader = new OdbcDataReader(command, command._cmdWrapper, CommandBehavior.Default); reader.FirstResult(); cColsAffected = reader.FieldCount; // go through the returned rows and filter out relevant parameter data // while (reader.Read()) { OdbcParameter parameter = new OdbcParameter(); parameter.ParameterName = reader.GetString(ODBC32.COLUMN_NAME - 1); switch ((ODBC32.SQL_PARAM)reader.GetInt16(ODBC32.COLUMN_TYPE - 1)) { case ODBC32.SQL_PARAM.INPUT: parameter.Direction = ParameterDirection.Input; break; case ODBC32.SQL_PARAM.OUTPUT: parameter.Direction = ParameterDirection.Output; break; case ODBC32.SQL_PARAM.INPUT_OUTPUT: parameter.Direction = ParameterDirection.InputOutput; break; case ODBC32.SQL_PARAM.RETURN_VALUE: parameter.Direction = ParameterDirection.ReturnValue; break; default: Debug.Assert(false, "Unexpected Parametertype while DeriveParamters"); break; } parameter.OdbcType = TypeMap.FromSqlType((ODBC32.SQL_TYPE)reader.GetInt16(ODBC32.DATA_TYPE - 1))._odbcType; parameter.Size = reader.GetInt32(ODBC32.COLUMN_SIZE - 1); switch (parameter.OdbcType) { case OdbcType.Decimal: case OdbcType.Numeric: parameter.Scale = (Byte)reader.GetInt32(ODBC32.DECIMAL_DIGITS - 1); parameter.Precision = (Byte)reader.GetInt32(ODBC32.NUM_PREC_RADIX - 1); break; } rParams.Add(parameter); } retcode = (ODBC32.RETCODE)UnsafeNativeMethods.Odbc32.SQLCloseCursor(hstmt); // Create a new Parameter array and copy over the ArrayList items // OdbcParameter[] pList = new OdbcParameter[rParams.Count]; for (int i = 0; i < rParams.Count; i++) { pList[i] = (OdbcParameter)rParams[i]; } return(pList); }
// DeriveParametersFromStoredProcedure ( // OdbcConnection connection, // OdbcCommand command); // // Uses SQLProcedureColumns to create an array of OdbcParameters // static private OdbcParameter[] DeriveParametersFromStoredProcedure(OdbcConnection connection, OdbcCommand command) { List <OdbcParameter> rParams = new List <OdbcParameter>(); // following call ensures that the command has a statement handle allocated CMDWrapper cmdWrapper = command.GetStatementHandle(); OdbcStatementHandle hstmt = cmdWrapper.StatementHandle; int cColsAffected; // maps an enforced 4-part qualified string as follows // parts[0] = null - ignored but removal would be a run-time breaking change from V1.0 // parts[1] = CatalogName (optional, may be null) // parts[2] = SchemaName (optional, may be null) // parts[3] = ProcedureName // string quote = connection.QuoteChar(ADP.DeriveParameters); string[] parts = MultipartIdentifier.ParseMultipartIdentifier(command.CommandText, quote, quote, '.', 4, true, Res.ODBC_ODBCCommandText, false); if (null == parts[3]) { // match Everett behavior, if the commandtext is nothing but whitespace set the command text to the whitespace parts[3] = command.CommandText; } // note: native odbc appears to ignore all but the procedure name ODBC32.RetCode retcode = hstmt.ProcedureColumns(parts[1], parts[2], parts[3], null); // Note: the driver does not return an error if the given stored procedure does not exist // therefore we cannot handle that case and just return not parameters. if (ODBC32.RetCode.SUCCESS != retcode) { connection.HandleError(hstmt, retcode); } using (OdbcDataReader reader = new OdbcDataReader(command, cmdWrapper, CommandBehavior.Default)) { reader.FirstResult(); cColsAffected = reader.FieldCount; // go through the returned rows and filter out relevant parameter data // while (reader.Read()) { // devnote: column types are specified in the ODBC Programmer's Reference // COLUMN_TYPE Smallint 16bit // COLUMN_SIZE Integer 32bit // DECIMAL_DIGITS Smallint 16bit // NUM_PREC_RADIX Smallint 16bit OdbcParameter parameter = new OdbcParameter(); parameter.ParameterName = reader.GetString(ODBC32.COLUMN_NAME - 1); switch ((ODBC32.SQL_PARAM)reader.GetInt16(ODBC32.COLUMN_TYPE - 1)) { case ODBC32.SQL_PARAM.INPUT: parameter.Direction = ParameterDirection.Input; break; case ODBC32.SQL_PARAM.OUTPUT: parameter.Direction = ParameterDirection.Output; break; case ODBC32.SQL_PARAM.INPUT_OUTPUT: parameter.Direction = ParameterDirection.InputOutput; break; case ODBC32.SQL_PARAM.RETURN_VALUE: parameter.Direction = ParameterDirection.ReturnValue; break; default: Debug.Assert(false, "Unexpected Parametertype while DeriveParamters"); break; } parameter.OdbcType = TypeMap.FromSqlType((ODBC32.SQL_TYPE)reader.GetInt16(ODBC32.DATA_TYPE - 1))._odbcType; parameter.Size = (int)reader.GetInt32(ODBC32.COLUMN_SIZE - 1); switch (parameter.OdbcType) { case OdbcType.Decimal: case OdbcType.Numeric: parameter.ScaleInternal = (Byte)reader.GetInt16(ODBC32.DECIMAL_DIGITS - 1); parameter.PrecisionInternal = (Byte)reader.GetInt16(ODBC32.NUM_PREC_RADIX - 1); break; } rParams.Add(parameter); } } retcode = hstmt.CloseCursor(); return(rParams.ToArray());; }
private static void DataTableFromDataReaderDataTypes(DataTable dataTypesTable, OdbcDataReader dataReader, OdbcConnection connection) { DataTable?schemaTable; // // Build a DataTable from the reader schemaTable = dataReader.GetSchemaTable(); // vstfdevdiv:479715 Handle cases where reader is empty if (null == schemaTable) { throw ADP.OdbcNoTypesFromProvider(); } object[] getTypeInfoValues = new object[schemaTable.Rows.Count]; DataRow dataTypesRow; DataColumn typeNameColumn = dataTypesTable.Columns[DbMetaDataColumnNames.TypeName] !; DataColumn providerDbTypeColumn = dataTypesTable.Columns[DbMetaDataColumnNames.ProviderDbType] !; DataColumn columnSizeColumn = dataTypesTable.Columns[DbMetaDataColumnNames.ColumnSize] !; DataColumn createParametersColumn = dataTypesTable.Columns[DbMetaDataColumnNames.CreateParameters] !; DataColumn dataTypeColumn = dataTypesTable.Columns[DbMetaDataColumnNames.DataType] !; DataColumn isAutoIncermentableColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsAutoIncrementable] !; DataColumn isCaseSensitiveColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsCaseSensitive] !; DataColumn isFixedLengthColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsFixedLength] !; DataColumn isFixedPrecisionScaleColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsFixedPrecisionScale] !; DataColumn isLongColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsLong] !; DataColumn isNullableColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsNullable] !; DataColumn isSearchableColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsSearchable] !; DataColumn isSearchableWithLikeColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsSearchableWithLike] !; DataColumn isUnsignedColumn = dataTypesTable.Columns[DbMetaDataColumnNames.IsUnsigned] !; DataColumn maximumScaleColumn = dataTypesTable.Columns[DbMetaDataColumnNames.MaximumScale] !; DataColumn minimumScaleColumn = dataTypesTable.Columns[DbMetaDataColumnNames.MinimumScale] !; DataColumn literalPrefixColumn = dataTypesTable.Columns[DbMetaDataColumnNames.LiteralPrefix] !; DataColumn literalSuffixColumn = dataTypesTable.Columns[DbMetaDataColumnNames.LiteralSuffix] !; DataColumn SQLTypeNameColumn = dataTypesTable.Columns[OdbcMetaDataColumnNames.SQLType] !; const int indexTYPE_NAME = 0; const int indexDATA_TYPE = 1; const int indexCOLUMN_SIZE = 2; const int indexCREATE_PARAMS = 5; const int indexAUTO_UNIQUE_VALUE = 11; const int indexCASE_SENSITIVE = 7; const int indexFIXED_PREC_SCALE = 10; const int indexNULLABLE = 6; const int indexSEARCHABLE = 8; const int indexUNSIGNED_ATTRIBUTE = 9; const int indexMAXIMUM_SCALE = 14; const int indexMINIMUM_SCALE = 13; const int indexLITERAL_PREFIX = 3; const int indexLITERAL_SUFFIX = 4; const int SQL_DATE_V2 = 9; const int SQL_TIME_V2 = 10; TypeMap?typeMap; while (dataReader.Read()) { dataReader.GetValues(getTypeInfoValues); dataTypesRow = dataTypesTable.NewRow(); ODBC32.SQL_TYPE sqlType; dataTypesRow[typeNameColumn] = getTypeInfoValues[indexTYPE_NAME]; dataTypesRow[SQLTypeNameColumn] = getTypeInfoValues[indexDATA_TYPE]; sqlType = (ODBC32.SQL_TYPE)(int) Convert.ChangeType(getTypeInfoValues[indexDATA_TYPE], typeof(int), null); // if the driver is pre version 3 and it returned the v2 SQL_DATE or SQL_TIME types they need // to be mapped to their v3 equivalent if (connection.IsV3Driver == false) { if ((int)sqlType == SQL_DATE_V2) { sqlType = ODBC32.SQL_TYPE.TYPE_DATE; } else if ((int)sqlType == SQL_TIME_V2) { sqlType = ODBC32.SQL_TYPE.TYPE_TIME; } } try { typeMap = TypeMap.FromSqlType(sqlType); } // FromSqlType will throw an argument exception if it does not recognize the SqlType. // This is not an error since the GetTypeInfo DATA_TYPE may be a SQL data type or a driver specific // type. If there is no TypeMap for the type its not an error but it will degrade our level of // understanding of/ support for the type. catch (ArgumentException) { typeMap = null; } // if we have a type map we can determine the dbType and the CLR type if not leave them null if (typeMap != null) { dataTypesRow[providerDbTypeColumn] = typeMap._odbcType; dataTypesRow[dataTypeColumn] = typeMap._type.FullName; // setting isLong and isFixedLength only if we have a type map because for provider // specific types we have no idea what the types attributes are if GetTypeInfo did not // tell us switch (sqlType) { case ODBC32.SQL_TYPE.LONGVARCHAR: case ODBC32.SQL_TYPE.WLONGVARCHAR: case ODBC32.SQL_TYPE.LONGVARBINARY: case ODBC32.SQL_TYPE.SS_XML: dataTypesRow[isLongColumn] = true; dataTypesRow[isFixedLengthColumn] = false; break; case ODBC32.SQL_TYPE.VARCHAR: case ODBC32.SQL_TYPE.WVARCHAR: case ODBC32.SQL_TYPE.VARBINARY: dataTypesRow[isLongColumn] = false; dataTypesRow[isFixedLengthColumn] = false; break; case ODBC32.SQL_TYPE.CHAR: case ODBC32.SQL_TYPE.WCHAR: case ODBC32.SQL_TYPE.DECIMAL: case ODBC32.SQL_TYPE.NUMERIC: case ODBC32.SQL_TYPE.SMALLINT: case ODBC32.SQL_TYPE.INTEGER: case ODBC32.SQL_TYPE.REAL: case ODBC32.SQL_TYPE.FLOAT: case ODBC32.SQL_TYPE.DOUBLE: case ODBC32.SQL_TYPE.BIT: case ODBC32.SQL_TYPE.TINYINT: case ODBC32.SQL_TYPE.BIGINT: case ODBC32.SQL_TYPE.TYPE_DATE: case ODBC32.SQL_TYPE.TYPE_TIME: case ODBC32.SQL_TYPE.TIMESTAMP: case ODBC32.SQL_TYPE.TYPE_TIMESTAMP: case ODBC32.SQL_TYPE.GUID: case ODBC32.SQL_TYPE.SS_VARIANT: case ODBC32.SQL_TYPE.SS_UTCDATETIME: case ODBC32.SQL_TYPE.SS_TIME_EX: case ODBC32.SQL_TYPE.BINARY: dataTypesRow[isLongColumn] = false; dataTypesRow[isFixedLengthColumn] = true; break; case ODBC32.SQL_TYPE.SS_UDT: default: // for User defined types don't know if its long or if it is // variable length or not so leave the fields null break; } } dataTypesRow[columnSizeColumn] = getTypeInfoValues[indexCOLUMN_SIZE]; dataTypesRow[createParametersColumn] = getTypeInfoValues[indexCREATE_PARAMS]; if ((getTypeInfoValues[indexAUTO_UNIQUE_VALUE] == DBNull.Value) || (Convert.ToInt16(getTypeInfoValues[indexAUTO_UNIQUE_VALUE], null) == 0)) { dataTypesRow[isAutoIncermentableColumn] = false; } else { dataTypesRow[isAutoIncermentableColumn] = true; } dataTypesRow[isCaseSensitiveColumn] = BooleanFromODBC(getTypeInfoValues[indexCASE_SENSITIVE]); dataTypesRow[isFixedPrecisionScaleColumn] = BooleanFromODBC(getTypeInfoValues[indexFIXED_PREC_SCALE]); if (getTypeInfoValues[indexNULLABLE] != DBNull.Value) { //Use Convert.ToInt16 instead of direct cast to short because the value will be Int32 in some cases switch ((ODBC32.SQL_NULLABILITY)Convert.ToInt16(getTypeInfoValues[indexNULLABLE], null)) { case ODBC32.SQL_NULLABILITY.NO_NULLS: dataTypesRow[isNullableColumn] = false; break; case ODBC32.SQL_NULLABILITY.NULLABLE: dataTypesRow[isNullableColumn] = true; break; case ODBC32.SQL_NULLABILITY.UNKNOWN: dataTypesRow[isNullableColumn] = DBNull.Value; break; } } if (DBNull.Value != getTypeInfoValues[indexSEARCHABLE]) { //Use Convert.ToInt16 instead of direct cast to short because the value will be Int32 in some cases short searchableValue = Convert.ToInt16(getTypeInfoValues[indexSEARCHABLE], null); switch (searchableValue) { case (short)ODBC32.SQL_SEARCHABLE.UNSEARCHABLE: dataTypesRow[isSearchableColumn] = false; dataTypesRow[isSearchableWithLikeColumn] = false; break; case (short)ODBC32.SQL_SEARCHABLE.LIKE_ONLY: dataTypesRow[isSearchableColumn] = false; dataTypesRow[isSearchableWithLikeColumn] = true; break; case (short)ODBC32.SQL_SEARCHABLE.ALL_EXCEPT_LIKE: dataTypesRow[isSearchableColumn] = true; dataTypesRow[isSearchableWithLikeColumn] = false; break; case (short)ODBC32.SQL_SEARCHABLE.SEARCHABLE: dataTypesRow[isSearchableColumn] = true; dataTypesRow[isSearchableWithLikeColumn] = true; break; } } dataTypesRow[isUnsignedColumn] = BooleanFromODBC(getTypeInfoValues[indexUNSIGNED_ATTRIBUTE]); //For assignment to the DataSet, don't cast the data types -- let the DataSet take care of any conversion if (getTypeInfoValues[indexMAXIMUM_SCALE] != DBNull.Value) { dataTypesRow[maximumScaleColumn] = getTypeInfoValues[indexMAXIMUM_SCALE]; } if (getTypeInfoValues[indexMINIMUM_SCALE] != DBNull.Value) { dataTypesRow[minimumScaleColumn] = getTypeInfoValues[indexMINIMUM_SCALE]; } if (getTypeInfoValues[indexLITERAL_PREFIX] != DBNull.Value) { dataTypesRow[literalPrefixColumn] = getTypeInfoValues[indexLITERAL_PREFIX]; } if (getTypeInfoValues[indexLITERAL_SUFFIX] != DBNull.Value) { dataTypesRow[literalSuffixColumn] = getTypeInfoValues[indexLITERAL_SUFFIX]; } dataTypesTable.Rows.Add(dataTypesRow); } }
private void DataTableFromDataReaderDataTypes(DataTable dataTypesTable, OdbcDataReader dataReader, OdbcConnection connection) { DataTable schemaTable = null; schemaTable = dataReader.GetSchemaTable(); if (schemaTable == null) { throw ADP.OdbcNoTypesFromProvider(); } object[] values = new object[schemaTable.Rows.Count]; DataColumn column19 = dataTypesTable.Columns[DbMetaDataColumnNames.TypeName]; DataColumn column18 = dataTypesTable.Columns[DbMetaDataColumnNames.ProviderDbType]; DataColumn column17 = dataTypesTable.Columns[DbMetaDataColumnNames.ColumnSize]; DataColumn column16 = dataTypesTable.Columns[DbMetaDataColumnNames.CreateParameters]; DataColumn column15 = dataTypesTable.Columns[DbMetaDataColumnNames.DataType]; DataColumn column6 = dataTypesTable.Columns[DbMetaDataColumnNames.IsAutoIncrementable]; DataColumn column14 = dataTypesTable.Columns[DbMetaDataColumnNames.IsCaseSensitive]; DataColumn column5 = dataTypesTable.Columns[DbMetaDataColumnNames.IsFixedLength]; DataColumn column13 = dataTypesTable.Columns[DbMetaDataColumnNames.IsFixedPrecisionScale]; DataColumn column4 = dataTypesTable.Columns[DbMetaDataColumnNames.IsLong]; DataColumn column3 = dataTypesTable.Columns[DbMetaDataColumnNames.IsNullable]; DataColumn column2 = dataTypesTable.Columns[DbMetaDataColumnNames.IsSearchable]; DataColumn column = dataTypesTable.Columns[DbMetaDataColumnNames.IsSearchableWithLike]; DataColumn column12 = dataTypesTable.Columns[DbMetaDataColumnNames.IsUnsigned]; DataColumn column11 = dataTypesTable.Columns[DbMetaDataColumnNames.MaximumScale]; DataColumn column10 = dataTypesTable.Columns[DbMetaDataColumnNames.MinimumScale]; DataColumn column9 = dataTypesTable.Columns[DbMetaDataColumnNames.LiteralPrefix]; DataColumn column8 = dataTypesTable.Columns[DbMetaDataColumnNames.LiteralSuffix]; DataColumn column7 = dataTypesTable.Columns[OdbcMetaDataColumnNames.SQLType]; while (dataReader.Read()) { TypeMap map; dataReader.GetValues(values); DataRow row = dataTypesTable.NewRow(); row[column19] = values[0]; row[column7] = values[1]; ODBC32.SQL_TYPE sqltype = (ODBC32.SQL_TYPE)((short)((int)Convert.ChangeType(values[1], typeof(int), null))); if (!connection.IsV3Driver) { if (sqltype == ~ODBC32.SQL_TYPE.WLONGVARCHAR) { sqltype = ODBC32.SQL_TYPE.TYPE_DATE; } else if (sqltype == ~ODBC32.SQL_TYPE.GUID) { sqltype = ODBC32.SQL_TYPE.TYPE_TIME; } } try { map = TypeMap.FromSqlType(sqltype); } catch (ArgumentException) { map = null; } if (map != null) { row[column18] = map._odbcType; row[column15] = map._type.FullName; switch (sqltype) { case ODBC32.SQL_TYPE.SS_TIME_EX: case ODBC32.SQL_TYPE.SS_UTCDATETIME: case ODBC32.SQL_TYPE.SS_VARIANT: case ODBC32.SQL_TYPE.GUID: case ODBC32.SQL_TYPE.WCHAR: case ODBC32.SQL_TYPE.BIT: case ODBC32.SQL_TYPE.TINYINT: case ODBC32.SQL_TYPE.BIGINT: case ODBC32.SQL_TYPE.BINARY: case ODBC32.SQL_TYPE.CHAR: case ODBC32.SQL_TYPE.NUMERIC: case ODBC32.SQL_TYPE.DECIMAL: case ODBC32.SQL_TYPE.INTEGER: case ODBC32.SQL_TYPE.SMALLINT: case ODBC32.SQL_TYPE.FLOAT: case ODBC32.SQL_TYPE.REAL: case ODBC32.SQL_TYPE.DOUBLE: case ODBC32.SQL_TYPE.TIMESTAMP: case ODBC32.SQL_TYPE.TYPE_DATE: case ODBC32.SQL_TYPE.TYPE_TIME: case ODBC32.SQL_TYPE.TYPE_TIMESTAMP: goto Label_02F8; case ODBC32.SQL_TYPE.SS_XML: case ODBC32.SQL_TYPE.WLONGVARCHAR: case ODBC32.SQL_TYPE.LONGVARBINARY: case ODBC32.SQL_TYPE.LONGVARCHAR: goto Label_02BC; case ODBC32.SQL_TYPE.WVARCHAR: case ODBC32.SQL_TYPE.VARBINARY: case ODBC32.SQL_TYPE.VARCHAR: goto Label_02DA; } } goto Label_0314; Label_02BC: row[column4] = true; row[column5] = false; goto Label_0314; Label_02DA: row[column4] = false; row[column5] = false; goto Label_0314; Label_02F8: row[column4] = false; row[column5] = true; Label_0314: row[column17] = values[2]; row[column16] = values[5]; if ((values[11] == DBNull.Value) || (Convert.ToInt16(values[11], null) == 0)) { row[column6] = false; } else { row[column6] = true; } row[column14] = this.BooleanFromODBC(values[7]); row[column13] = this.BooleanFromODBC(values[10]); if (values[6] != DBNull.Value) { switch (((ODBC32.SQL_NULLABILITY)((ushort)Convert.ToInt16(values[6], null)))) { case ODBC32.SQL_NULLABILITY.NO_NULLS: row[column3] = false; break; case ODBC32.SQL_NULLABILITY.NULLABLE: row[column3] = true; break; case ODBC32.SQL_NULLABILITY.UNKNOWN: row[column3] = DBNull.Value; break; } } if (DBNull.Value != values[8]) { switch (Convert.ToInt16(values[8], null)) { case 0: row[column2] = false; row[column] = false; break; case 1: row[column2] = false; row[column] = true; break; case 2: row[column2] = true; row[column] = false; break; case 3: row[column2] = true; row[column] = true; break; } } row[column12] = this.BooleanFromODBC(values[9]); if (values[14] != DBNull.Value) { row[column11] = values[14]; } if (values[13] != DBNull.Value) { row[column10] = values[13]; } if (values[3] != DBNull.Value) { row[column9] = values[3]; } if (values[4] != DBNull.Value) { row[column8] = values[4]; } dataTypesTable.Rows.Add(row); } }