Поделиться через


Value

The value is the actual value of the data. For example, the value of a column containing last names might be "Smith." Unless the type indicator of the data is DBTYPE_BSTR or is combined with DBTYPE_BYREF, DBTYPE_ARRAY, or DBTYPE_VECTOR, the data is stored directly at the offset specified in the binding. Sufficient space must be allocated for the data.

For example, if the type indicator is DBTYPE_I2, a two-byte integer is stored at the specified offset and two bytes must be available for write at that offset. If the type indicator is DBTYPE_STR, an ANSI string is stored at the specified offset. If the length of the string in bytes is longer than the number of bytes specified in the cbMaxLen element of the DBBINDING structure, the string is truncated.

If the type indicator is DBTYPE_BSTR or is combined with DBTYPE_BYREF, DBTYPE_ARRAY, or DBTYPE_VECTOR, a pointer to the data is stored at the offset specified in the binding and the data is stored in separately allocated memory. For example, if the type indicator is DBTYPE_STR | DBTYPE_BYREF, a pointer to an ANSI string is stored at the specified offset and sizeof(char *) bytes must be allocated at that offset. The string itself is stored in separately allocated memory. For more information, see Type Indicators in Appendix A: Data Types.

The only exception to these rules is when a reference accessor is used, in which case the value is a pointer to the provider's buffer for rowset data or a pointer to the consumer's buffer for input parameter data. For more information, see Reference Accessors.

This topic is a part of: