MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 6: Getting and Setting Data
The status indicates whether the data value or some other value, such as a NULL, is to be used as the value of the column or parameter. If the data value is to be used, the consumer sets the status to DBSTATUS_S_OK on input. On output, the provider returns information about whether the consumer was able to set or get the value. The status is described in the DBSTATUS enumerated type defined in Appendix D, "Cotypes, Structures, and Enumerated Types."
To get rowset or output parameter data, use ICommand::Execute, IMultipleResults::GetResults, IRowset::GetData, IRowsetRefresh::GetLastVisibleData, and IRowsetUpdate::GetOriginalData. As the provider returns the data, it sets the status of each column or output parameter so that the consumer can determine which data values it got successfully. It produces the return codes as follows:
Note Truncation of variable length data is a warning condition when getting data. The corresponding status is set to DBSTATUS_S_TRUNCATED.
If the provider returns a fatal error other than DB_E_ERRORSOCCURRED, such as E_FAIL, the returned status values are undefined.
The following table explains the meaning of each returned status value, whether it is a success, error, or warning condition, and whether data was successfully returned.
Status value | Success, warning, or error | Data returned | Description |
DBSTATUS_S_OK | Success | Y | The provider returned a non-null value. |
DBSTATUS_S_ISNULL | Success | Y | The provider returned a null value. |
DBSTATUS_S_TRUNCATED | Warning | Y | Variable-length data was truncated. |
DBSTATUS_E_BADACCESSOR | Error | N | Accessor validation was deferred and was performed while the method returned data. The binding was invalid for this column or parameter.
For a description of the cases that might cause deferred accessor validation to fail, see the description of the DBBINDSTATUS values listed under the rgStatus argument in the reference entry for "IAccessor::CreateAccessor." |
DBSTATUS_E_CANTCONVERTVALUE | Error | N | The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable. |
DBSTATUS_E_CANTCREATE | Error | N | One of the following conditions:
|
DBSTATUS_E_DATAOVERFLOW | Error | N | Conversion failed because the data value overflowed the type specified for the value part in the consumer's buffer. |
DBSTATUS_E_SIGNMISMATCH | Error | N | Conversion failed because the data value was signed and the type specified for the value part in the consumer's buffer was unsigned. |
DBSTATUS_E_UNAVAILABLE | Error | N | The provider could not determine the value. For example, the row was just created, the default for the column was not available, and the consumer had not yet set a new value. |
To set rowset data or to set input parameter data, use ICommand::Execute, IRowsetChange::SetData, IRowsetChange::InsertRow, IRowsetIndex::Seek, and IRowsetIndex::SetRange. When calling these methods, the consumer must set the status to one of the values in the following table.
As the provider transfers data from the consumer to the provider, it sets the status of each column or input parameter so that the consumer can determine which data values were successfully set. The provider produces return codes as follows:
Note Truncation of variable-length data is an error condition when setting data. The corresponding status is set to DBSTATUS_E_CANTCONVERTVALUE or DBSTATUS_E_OVERFLOW as appropriate.
If the provider returns a fatal error other than DB_E_ERRORSOCCURRED, such as E_FAIL, the returned status values are undefined. If the consumer did not bind the status for a column or input parameter and the method returns DB_S_ERRORSOCCURRED or DB_E_ERRORSOCCURRED, the consumer must assume that the value for that column or input parameter was not successfully set.
The following table explains the meaning of each returned status value, whether it is a success or error condition, and whether data was successfully sent.
Status value |
Success, warning, or error |
Data sent |
Description |
DBSTATUS_S_OK | Success | Y | A non-null value was sent to the provider. |
DBSTATUS_S_ISNULL | Success | Y | A null value was sent to the provider. |
DBSTATUS_S_DEFAULT | Success | Y | The provider used the default value for an input parameter in a procedure. If the provider used the default value on input for an input/output parameter, the status is set to the status of the output value on output. |
DBSTATUS_S_IGNORE | Success | N | The consumer specified DBSTATUS_S_IGNORE when setting data, and the provider ignored the column. |
DBSTATUS_E_BADACCESSOR | Error | N | Accessor validation was deferred and was performed while the method sent data. The binding was invalid for this column or parameter.
For a description of the cases that may cause deferred accessor validation to fail, see the description of the DBBINDSTATUS values listed under the rgStatus argument of in the reference entry for "IAccessor::CreateAccessor." |
DBSTATUS_E_BADSTATUS | Error | N | One of the following conditions:
|
DBSTATUS_E_CANTCONVERTVALUE | Error | N | The data value could not be converted for reasons other than sign mismatch or data overflow. For example, converting the data would have truncated it, including truncating nonsignificant digits in numeric data. |
DBSTATUS_E_CANTCREATE | Error | N | The type indicator for the column was DBTYPE_IUNKNOWN, the provider supports only one open storage object at a time (DBPROP_MULTIPLESTORAGEOBJECTS was VARIANT_FALSE), and a storage object was already open on the rowset. |
DBSTATUS_E_DATAOVERFLOW | Error | N | Conversion failed because the data value overflowed the type used by the provider. |
DBSTATUS_E_INTEGRITYVIOLATION | Error | N | The data value violated the integrity constraints for the column. |
DBSTATUS_E_PERMISSIONDENIED | Error | N | The DBPROP_COLUMNRESTRICT property was VARIANT_TRUE, and the user did not have permission to write to the column. |
DBSTATUS_E_SCHEMAVIOLATION | Error | N | The data value violated the schema's constraint for the column. |
DBSTATUS_E_SIGNMISMATCH | Error | N | Conversion failed because the data value was signed and the type used by the provider was unsigned. |
DBSTATUS_E_UNAVAILABLE | Error | N | One of the following conditions:
|