Chapter 13: Data Types in OLE DB

OLE DB Programmer's Reference

This chapter introduces OLE DB data type indicators. Providers use these type indicators to tell consumers what data types they support. Consumers use them when creating tables and when getting and setting data. Example mappings from native data types to OLE DB data type indicators are given for an ANSI SQL provider, a Microsoft Access provider, and a Microsoft SQL Server provider. The treatment of string values and provider support for data type conversions are also discussed.

For more information on Go to
Consumers and providers "Conceptual Programming Models in OLE DB," in Chapter 1: Overview of OLE DB
Using type indicators in providers "Using Type Indicators in Providers," in this chapter
Type indicators in an ANSI SQL Provider "Type Indicators in an ANSI SQL Provider," in this chapter
Type indicators in a Microsoft Access provider "Type Indicators in a Microsoft Access Provider," in this chapter
Type indicators in a Microsoft SQL Server provider "Type Indicators in a Microsoft SQL Server Provider," in this chapter
Using type indicators in consumers "Using Type Indicators in Consumers," in this chapter
Using type indicators when creating tables in consumers "Using Type Indicators When Creating Tables," in this chapter
Using type indicators when getting and setting data in consumers "Using Type Indicators When Getting and Setting Data," in this chapter
Determining the type of data from a string "String Data," in this chapter
Fixed-length and variable-length data "Fixed-Length and Variable-Length Data Types," in this chapter
Provider support for data type conversions "Data Type Conversion," in this chapter

OLE DB uses standard OLE and Microsoft Windows data types. To describe a data type, a type indicator is used. This is a variable of the enumerated type DBTYPE that is passed as metadata. Although it is easy to confuse the two, type indicators are not data types. For example, DBTYPE_GUID is an integer with a value of 72, not a GUID. It is used to indicate that a piece of memory contains a GUID. For more information on how data types map to type indicators as well as a complete list of type indicators, see "Type Indicators" in Appendix A: Data Types.

Places where type indicators are used include the following:

  • Metadata. Type indicators are used to specify the data type of a column or parameter.
  • DBBINDING structures. The wType element of the DBBINDING structure describes the type of the bound data value. When getting data, this is the type to which the provider converts the data before returning it to the consumer. When setting data, this is the type from which the provider converts the data after retrieving it from the consumer.
  • VARIANT structures. The vt element, a short integer, of the VARIANT structure indicates the type of the data that is stored in the structure. The remainder of the structure is 14 bytes, which are structured according to the vt tag. The DBTYPE enumerated type is a superset of the VARENUM enumerated type, so some DBTYPE values cannot be used in VARIANT structures.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net