The most important information in the ODSUSERTYPE data structure is the fType value. In most cases, this should be an ODBC datatype code, as defined in the Microsoft ODBC 2.0 Programmer's Reference and SDK Guide. (The datatype constants themselves are defined in the ODBC header files SQL.H and SQLEXT.H.)
When fType refers to an ODBC datatype code, fNew should be set to NEWODBCTYPE. The Open Data Services ODBC driver will then look up additional information about the datatype in the gateway resources DLL file, such as its native name and its use in a search clause. In the sample resources DLL file shipped with this toolkit, these datatype definitions are defined in the LOCAL.RC source file, starting with IDS_DATATYPE_OFFSET+0. The Open Data Services ODBC driver will find the first datatype definition whose DATA_TYPE value (second column) matches the fType set by the gateway.
The IDS_DATATYPE_OFFSET strings include values for NULLABLE and CASE SENSITIVE that apply to a datatype as a class. If these values indicate that a datatype can be null or is case sensitive, the Open Data Services ODBC driver will use the values of the fNullable and fCaseSensitive flags to determine if a given column instance of the datatype can contain null values or is case sensitive.
For some data sources, there may be more than one source datatype that matches an ODBC datatype. For example, a data source might support both a MONEY datatype and a DECIMAL datatype, both of which map to the ODBC datatype SQL_DECIMAL. To distinguish between the different source datatypes in this case, set the fNew flag to NEWUSERTYPE. The Open Data Services ODBC driver will then interpret the fType code as a USER_TYPE (last column) when looking up the datatype attributes in the resources DLL.