Mapping ODBC Functions to OLE DB Methods

Because a direct mapping between ODBC functions and OLE DB methods does not exist in all cases, only similar functionality is provided. When more than one method can be used to achieve the same thing, the methods are separated with the word "or," for example, MethodA or MethodB. When more than one method must be called in sequence, the methods are numbered, for example, 1. MethodA, 2. MethodB, and so on.

ODBC function OLE DB method Remarks/property
SQLAllocHandle

  Environment

  Connection

  Descriptor

  Statement

OleInitialize

CoCreateInstance

IAccessor::CreateAccessor

IDBCreateCommand::CreateCommand

SQLBindCol IAccessor::CreateAccessor
SQLBindParameter IAccessor::CreateAccessor
SQLBrowseConnect ISourcesRowset::GetSourcesRowset
SQLBulkOperations

  Insertions

  Deletions

  Updates

  Retrieve by bookmark

IRowsetChange::InsertRows

IRowsetChange::DeleteRows

IRowsetChange::SetData

IRowsetLocate::GetRowsByBookmark

If IRowsetUpdate is requested, all operations are batched until IRowsetUpdate::Update is called
SQLCancel ICommand::Cancel
SQLCloseCursor IRowset::Release
SQLColAttribute IColumnsInfo::GetColumnInfo or IColumnsRowset::GetColumnsRowset
SQLColumnPrivileges IDBSchemaRowset::GetRowset DBSCHEMA_

COLUMN_PRIVILEGES

SQLColumns IDBSchemaRowset::GetRowset DBSCHEMA_COLUMNS
SQLConnect 1. IDBProperties::SetProperties

2. IDBInitialize::Initialize

SQLDataSources ISourcesRowset::GetSourcesRowset
SQLDescribeCol IColumnsInfo::GetColumnInfo
SQLDescribeParam ICommandWithParameters::

GetParameterInfo

SQLDisconnect IDBInitialize::Uninitialize
SQLDriverConnect 1. IDBProperties::SetProperties

2. IDBInitialize::Initialize

SQLDrivers ISourcesRowset::GetSourcesRowset
SQLEndTran ITransaction::Commit or ITransaction::Abort
SQLError 1. GetErrorInfo

2. IErrorRecords

3. IErrorInfo

SQLExecDirect ICommand::Execute
SQLExecute ICommand::Execute
SQLFetch 1. IRowset::GetNextRows,

IRowsetLocate::GetRowsAt, or

IRowsetLocate::GetRowsByBookmark

2. IRowset::GetData

SQLFetchScroll 1. IRowset::GetNextRows,

IRowsetLocate::GetRowsAt, or

IRowsetLocate::GetRowsByBookmark

2. IRowset::GetData

SQLForeignKeys IDBSchemaRowset::GetRowset DBSCHEMA_

FOREIGN_KEYS

SQLFreeHandle

  Environment

  Connection

  Descriptor

  Statement

OleUninitialize

IDBInitialize::Release

IAccessor::ReleaseAccessor

IRowset::Release

SQLFreeStmt

  SQL_DROP

  SQL_CLOSE

  SQL_UNBIND

  SQL_RESET_

  PARAMS

ICommand::Release

IRowset::Release

IAccessor::ReleaseAccessor

IAccessor::ReleaseAccessor

SQLGetConnectAttr IDBProperties::GetProperties
SQLGetCursorName Not applicable OLE DB performs updates through update methods, as opposed to positioned cursor operations
SQLGetData IRowset::GetData

(for all data except BLOBs) or

ILockBytes, ISequentialStream, IStorage, or IStream (for BLOB data)

SQLGetDescField IAccessor::GetBindings Elements within binding structure
SQLGetDescRec IAccessor::GetBindings Elements within binding structure
SQLDiagField 1. GetErrorInfo

2. IErrorRecords

3. IErrorInfo

SQLDiagRec 1. GetErrorInfo

2. IErrorRecords

3. IErrorInfo

SQLGetEnvAttr IDBProperties::GetProperties
SQLGetFunctions IUnknown::QueryInterface
SQLGetInfo IDBProperties::GetProperties
SQLGetStmtAttr ICommandProperties::GetProperties or IRowsetInfo::GetProperties
SQLGetTypeInfo IDBSchemaRowset::GetRowset DBSCHEMA_

PROVIDER_TYPES

SQLMoreResults IMultipleResults
SQLNativeSql ICommandText::GetCommandText With NULL as pguidDialect
SQLNumParams ICommandWithParams::GetParameterInfo
SQLNumResultCols IColumnsInfo::GetColumnInfo
SQLParamData Not applicable
SQLPrepare ICommand::Prepare
SQLPrimaryKeys IDBSchemaRowset::GetRowset DBSCHEMA_

PRIMARY_KEYS

SQLProcedureColumns IDBSchemaRowset::GetRowset DBSCHEMA_

PROCEDURE_PARAMETERS, DBSCHEMA_

PROCEDURE_COLUMNS

SQLProcedures IDBSchemaRowset::GetRowset DBSCHEMA_PROCEDURES
SQLPutData IRowsetChange::SetData

(for all data except BLOBs) or

ISequentialStream (for BLOB data)

SQLRowCount cRowsAffected in ICommand::Execute
SQLSetConnectAttr IDBProperties::SetProperties
SQLSetCursorName Not applicable OLE DB performs updates through update methods, as opposed to positioned cursor operations
SQLSetDescField IAccessor::CreateAccessor Elements within binding structure
SQLSetDescRec IAccessor::CreateAccessor Elements within binding structure
SQLSetEnvAttr IDBProperties::SetProperties
SQLSetParam ICommandWithParameters::SetParameterInfo
SQLSetPos

   SQL_POSITION

   SQL_REFRESH

   SQL_UPDATE

   SQL_DELETE

   SQL_ADD

Not applicable

IRowset::GetData or IRowsetResynch

IRowsetChange::SetData

IRowsetChange::Delete

IRowsetChange::InsertRow

IRowsetUpdate::Update

SQLSetStmtAttr ICommandProperties::SetProperties
SQLSpecialColumns IColumnsInfo::GetColumnInfo DBCOLUMNFLAGS_

ISROWID and DBCOLUMNFLAGS_

ISROWVER

SQLStatistics IDBSchemaRowset::GetRowset DBSCHEMA_STATISTICS
SQLTablePrivileges IDBSchemaRowset::GetRowset DBSCHEMA_TABLE_

PRIVILEGES

SQLTables IDBSchemaRowset::GetRowset DBSCHEMA_TABLES
SQLTransact ITransaction::Abort and ITransaction::Commit