CTempBSTR

SQL-DMO

SQL-DMO

CTempBSTR

The CTempBSTR template class wraps an OLE BSTR object. When used to maintain references on BSTR objects returned by SQL-DMO, the class ensures that references are released when:

  • An instance of the class is destroyed.

  • An instance of the class is maintaining an existing reference and is assigned a new reference.
Member Functions
CTempBSTR::b

SQLDMO_BSTR b( );

Returns an SQLDMO_BSTR from the instance without incrementing the reference count maintained on the BSTR. Returns NULL if the instance is not maintaining a reference.

CTempBSTR::CTempBSTR

CTempBSTR( );

CTempBSTR(SQLDMO_BSTR bstrIn);

Creates an instance of the class.

CTempBSTR::Free

void Free( );

Safely releases a BSTR reference maintained by the instance. The function is provided for class completeness. Class destruction and assignment operator implementations ensure reference release, and the use of Free is not required by an application.

Operators
CTempBSTR::operator SQLDMO_LPCSTR

operator SQLDMO_LPCSTR ( );

Returns an SQLDMO_LPCSTR pointing to the character string maintained by the BSTR object wrapped. Returns NULL if the instance is not maintaining a reference on a BSTR object.

CTempBSTR::operator void*

operator void* ( );

Returns a void pointer to the memory maintaining a BSTR object reference.

CTempBSTR::operator =

SQLDMO_BSTR operator = (SQLDMO_BSTR bstrIn);

If a BSTR reference is maintained by the instance, the reference is released. The instance maintains the reference on the BSTR object assigned to the instance. Returns the reference assigned.

CTempBSTR::operator &

SQLDMO_BSTR* operator & ( );

Returns a pointer to the memory maintaining a BSTR object reference as a pointer to a SQLDMO_BSTR.

CTempBSTR::operator !

BOOL operator ! ( );

Returns FALSE when an instance maintains a reference on a BSTR object. Returns TRUE otherwise.