Data is defined as and stored by many types, so it is required that both the provider and consumer be able to understand the type. Presented here is the topic of determining data type in OLE DB by the use of type indicators when creating tables and getting and setting data, handling string data, fixed- and variable-length data, and converting data. Type indicators in an ANSI SQL Provider, a Microsoft Access provider, and a Microsoft service component are discussed in detail. Determining the type of data from a string (collectively referring to ANSI, Unicode, and BSTR), and provider support for data type conversions are also presented.
For more information on | Go to |
Consumers and providers | "Consumers and Providers" 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 service component | "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- and variable-length data | "Fixed- 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 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. Type indicators are used in many places, including the following:
For a complete list of type indicators, see "Type Indicators" in Appendix A.