NCBI C++ ToolKit
Classes | Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Attributes | Friends | List of all members
CODBC_RowResult Class Reference

Search Toolkit Book for CODBC_RowResult

#include <dbapi/driver/odbc/interfaces.hpp>

+ Inheritance diagram for CODBC_RowResult:
+ Collaboration diagram for CODBC_RowResult:

Classes

struct  t_SODBC_ColDescr
 

Public Member Functions

CStatementBaseGetStatementBase (void)
 
const CStatementBaseGetStatementBase (void) const
 
EEncoding GetClientEncoding (void) const
 
- Public Member Functions inherited from impl::CResult
 CResult (void)
 
virtual ~CResult (void)
 
virtual const CDBParamsGetDefineParams (void) const
 
I_BlobDescriptorGetImageOrTextDescriptor (void)
 
void AttachTo (CDB_Result *interface)
 
const CDB_ParamsGetDefineParamsImpl (void) const
 
CDB_ParamsGetDefineParamsImpl (void)
 

Protected Types

typedef AutoPtr< char, ArrayDeleter< char > > TItemBuffer
 

Protected Member Functions

 CODBC_RowResult (CStatementBase &stmt, SQLSMALLINT nof_cols, SQLLEN *row_count)
 
virtual ~CODBC_RowResult (void)
 
virtual EDB_ResType ResultType (void) const
 Get type of the result. More...
 
virtual bool Fetch (void)
 Fetch next row. More...
 
virtual int CurrentItemNo (void) const
 Return current item number we can retrieve (0,1,...) Return "-1" if no more items left (or available) to read. More...
 
virtual int GetColumnNum (void) const
 Return number of columns in the recordset. More...
 
virtual CDB_ObjectGetItem (CDB_Object *item_buf=0, I_Result::EGetItem policy=I_Result::eAppendLOB)
 Get a result item (you can use either GetItem or ReadItem). More...
 
virtual size_t ReadItem (void *buffer, size_t buffer_size, bool *is_null=0)
 Read a result item body (for BLOB columns, mostly). More...
 
virtual I_BlobDescriptorGetBlobDescriptor (void)
 Get a descriptor for a BLOB column (for SendData). More...
 
CDB_BlobDescriptorGetBlobDescriptor (int item_no, const string &cond)
 
virtual bool SkipItem (void)
 Skip result item. More...
 
int xGetData (SQLSMALLINT target_type, SQLPOINTER buffer, SQLINTEGER buffer_size, bool *more=NULL)
 
ssize_t x_GetVarLenData (SQLSMALLINT target_type, TItemBuffer &buffer, SQLINTEGER buffer_size)
 
CDB_Objectx_LoadItem (I_Result::EGetItem policy, CDB_Object *item_buf)
 
CDB_Objectx_MakeItem (void)
 
SQLHSTMT GetHandle (void) const
 
void ReportErrors (void)
 
void ReportError (CDB_Exception &ex) const
 
const CODBC_Connection::TDbgInfoGetDbgInfo (void) const
 
const CDBParamsGetLastParams (void) const
 
const CODBC_ConnectionGetConnection (void) const
 
void Close (void)
 
bool CheckSIENoD_Text (CDB_Stream *val)
 
bool CheckSIENoD_WText (CDB_Stream *val)
 
bool CheckSIENoD_Binary (CDB_Stream *val)
 

Private Types

enum  { eODBC_Column_Name_Size = 80 }
 
typedef struct CODBC_RowResult::t_SODBC_ColDescr SODBC_ColDescr
 

Private Attributes

CStatementBasem_Stmt
 
int m_CurrItem
 
bool m_EOR
 
unsigned int m_CmdNum
 
SODBC_ColDescrm_ColFmt
 
SQLLEN *const m_RowCountPtr
 
string m_LastReadData
 
bool m_HasMoreData
 

Friends

class CODBC_LangCmd
 
class CODBC_RPCCmd
 
class CODBC_CursorCmd
 
class CODBC_Connection
 
class CODBC_CursorCmdExpl
 
class CODBC_SendDataCmd
 

Additional Inherited Members

- Protected Attributes inherited from impl::CResult
CDB_Params m_DefineParams
 
CCachedRowInfo m_CachedRowInfo
 

Detailed Description

Definition at line 725 of file interfaces.hpp.

Member Typedef Documentation

◆ SODBC_ColDescr

◆ TItemBuffer

typedef AutoPtr<char, ArrayDeleter<char> > CODBC_RowResult::TItemBuffer
protected

Definition at line 758 of file interfaces.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
eODBC_Column_Name_Size 

Definition at line 823 of file interfaces.hpp.

Constructor & Destructor Documentation

◆ CODBC_RowResult()

CODBC_RowResult::CODBC_RowResult ( CStatementBase stmt,
SQLSMALLINT  nof_cols,
SQLLEN row_count 
)
protected

◆ ~CODBC_RowResult()

CODBC_RowResult::~CODBC_RowResult ( void  )
protectedvirtual

Definition at line 1266 of file result.cpp.

References Close(), m_ColFmt, m_EOR, NCBI_CATCH_ALL_X, and NCBI_CURRENT_FUNCTION.

Member Function Documentation

◆ CheckSIENoD_Binary()

bool CODBC_RowResult::CheckSIENoD_Binary ( CDB_Stream val)
protected

◆ CheckSIENoD_Text()

bool CODBC_RowResult::CheckSIENoD_Text ( CDB_Stream val)
protected

◆ CheckSIENoD_WText()

bool CODBC_RowResult::CheckSIENoD_WText ( CDB_Stream val)
protected

◆ Close()

void CODBC_RowResult::Close ( void  )
inlineprotected

Definition at line 808 of file interfaces.hpp.

References CStatementBase::Close(), and GetStatementBase().

Referenced by ~CODBC_RowResult().

◆ CurrentItemNo()

int CODBC_RowResult::CurrentItemNo ( void  ) const
protectedvirtual

Return current item number we can retrieve (0,1,...) Return "-1" if no more items left (or available) to read.

Implements impl::CResult.

Definition at line 211 of file result.cpp.

References m_CurrItem.

◆ Fetch()

bool CODBC_RowResult::Fetch ( void  )
protectedvirtual

◆ GetBlobDescriptor() [1/2]

CDB_BlobDescriptor * CODBC_RowResult::GetBlobDescriptor ( int  item_no,
const string cond 
)
protected

◆ GetBlobDescriptor() [2/2]

I_BlobDescriptor * CODBC_RowResult::GetBlobDescriptor ( void  )
protectedvirtual

Get a descriptor for a BLOB column (for SendData).

Return NULL if this result doesn't (or can't) have a BLOB descriptor. NOTE: you need to call ReadItem (maybe even with buffer_size == 0) before calling this method!

Implements impl::CResult.

Definition at line 1251 of file result.cpp.

References m_CurrItem.

Referenced by CODBC_CursorCmd::x_GetBlobDescriptor().

◆ GetClientEncoding()

EEncoding CODBC_RowResult::GetClientEncoding ( void  ) const
inline

◆ GetColumnNum()

int CODBC_RowResult::GetColumnNum ( void  ) const
protectedvirtual

Return number of columns in the recordset.

Implements impl::CResult.

Definition at line 216 of file result.cpp.

References impl::CResult::GetDefineParams(), and CDBParams::GetNum().

◆ GetConnection()

const CODBC_Connection& CODBC_RowResult::GetConnection ( void  ) const
inlineprotected

Definition at line 804 of file interfaces.hpp.

References CStatementBase::GetConnection(), and GetStatementBase().

◆ GetDbgInfo()

const CODBC_Connection::TDbgInfo& CODBC_RowResult::GetDbgInfo ( void  ) const
inlineprotected

◆ GetHandle()

SQLHSTMT CODBC_RowResult::GetHandle ( void  ) const
inlineprotected

◆ GetItem()

CDB_Object * CODBC_RowResult::GetItem ( CDB_Object item_buf = 0,
I_Result::EGetItem  policy = I_Result::eAppendLOB 
)
protectedvirtual

Get a result item (you can use either GetItem or ReadItem).

If "item_buf" is not NULL, then use "*item_buf" (its type should be compatible with the type of retrieved item!) to retrieve the item to; otherwise allocate new "CDB_Object".

Implements impl::CResult.

Definition at line 1059 of file result.cpp.

References impl::CResult::GetDefineParams(), m_CurrItem, x_LoadItem(), and x_MakeItem().

◆ GetLastParams()

const CDBParams* CODBC_RowResult::GetLastParams ( void  ) const
inlineprotected

Definition at line 800 of file interfaces.hpp.

References impl::CBaseCmd::GetLastParams(), and m_Stmt.

◆ GetStatementBase() [1/2]

CStatementBase& CODBC_RowResult::GetStatementBase ( void  )
inline

Definition at line 735 of file interfaces.hpp.

References m_Stmt.

Referenced by Close(), GetClientEncoding(), GetConnection(), GetDbgInfo(), GetHandle(), ReportError(), and ReportErrors().

◆ GetStatementBase() [2/2]

const CStatementBase& CODBC_RowResult::GetStatementBase ( void  ) const
inline

Definition at line 739 of file interfaces.hpp.

References m_Stmt.

◆ ReadItem()

size_t CODBC_RowResult::ReadItem ( void *  buffer,
size_t  buffer_size,
bool is_null = 0 
)
protectedvirtual

Read a result item body (for BLOB columns, mostly).

Return number of successfully read bytes. Set "*is_null" to TRUE if the item is <NULL>. Throw an exception on any error.

Implements impl::CResult.

Definition at line 1072 of file result.cpp.

References buffer, buffer_size, CWString::ConvertTo(), DATABASE_DRIVER_ERROR, CODBC_RowResult::t_SODBC_ColDescr::DataType, f(), GetClientEncoding(), GetDbgInfo(), impl::CResult::GetDefineParams(), GetHandle(), m_ColFmt, m_CurrItem, m_HasMoreData, m_LastReadData, ReportErrors(), SQL_C_BINARY, SQL_ERROR, SQL_NO_DATA, SQL_NO_TOTAL, SQL_NULL_DATA, SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_WCHAR, SQL_WLONGVARCHAR, SQL_WVARCHAR, SQLGetData(), and SQLLEN.

◆ ReportError()

void CODBC_RowResult::ReportError ( CDB_Exception ex) const
inlineprotected

Definition at line 790 of file interfaces.hpp.

References GetStatementBase(), and CStatementBase::ReportError().

◆ ReportErrors()

void CODBC_RowResult::ReportErrors ( void  )
inlineprotected

◆ ResultType()

EDB_ResType CODBC_RowResult::ResultType ( void  ) const
protectedvirtual

Get type of the result.

Implements impl::CResult.

Reimplemented in CODBC_ParamResult, and CODBC_StatusResult.

Definition at line 169 of file result.cpp.

References eDB_RowResult.

◆ SkipItem()

bool CODBC_RowResult::SkipItem ( void  )
protectedvirtual

Skip result item.

Implements impl::CResult.

Definition at line 1256 of file result.cpp.

References impl::CResult::GetDefineParams(), and m_CurrItem.

◆ x_GetVarLenData()

ssize_t CODBC_RowResult::x_GetVarLenData ( SQLSMALLINT  target_type,
TItemBuffer buffer,
SQLINTEGER  buffer_size 
)
protected

Definition at line 263 of file result.cpp.

References _ASSERT, buffer, buffer_size, i, n, SQL_C_CHAR, SQL_C_WCHAR, and xGetData().

Referenced by x_LoadItem(), and x_MakeItem().

◆ x_LoadItem()

CDB_Object * CODBC_RowResult::x_LoadItem ( I_Result::EGetItem  policy,
CDB_Object item_buf 
)
protected

◆ x_MakeItem()

CDB_Object * CODBC_RowResult::x_MakeItem ( void  )
protected

◆ xGetData()

int CODBC_RowResult::xGetData ( SQLSMALLINT  target_type,
SQLPOINTER  buffer,
SQLINTEGER  buffer_size,
bool more = NULL 
)
protected

Friends And Related Function Documentation

◆ CODBC_Connection

friend class CODBC_Connection
friend

Definition at line 730 of file interfaces.hpp.

◆ CODBC_CursorCmd

friend class CODBC_CursorCmd
friend

Definition at line 729 of file interfaces.hpp.

◆ CODBC_CursorCmdExpl

friend class CODBC_CursorCmdExpl
friend

Definition at line 731 of file interfaces.hpp.

◆ CODBC_LangCmd

friend class CODBC_LangCmd
friend

Definition at line 727 of file interfaces.hpp.

◆ CODBC_RPCCmd

friend class CODBC_RPCCmd
friend

Definition at line 728 of file interfaces.hpp.

◆ CODBC_SendDataCmd

friend class CODBC_SendDataCmd
friend

Definition at line 732 of file interfaces.hpp.

Member Data Documentation

◆ m_CmdNum

unsigned int CODBC_RowResult::m_CmdNum
private

Definition at line 822 of file interfaces.hpp.

◆ m_ColFmt

SODBC_ColDescr* CODBC_RowResult::m_ColFmt
private

Definition at line 832 of file interfaces.hpp.

Referenced by CODBC_RowResult(), ReadItem(), x_LoadItem(), x_MakeItem(), and ~CODBC_RowResult().

◆ m_CurrItem

int CODBC_RowResult::m_CurrItem
private

◆ m_EOR

bool CODBC_RowResult::m_EOR
private

Definition at line 821 of file interfaces.hpp.

Referenced by Fetch(), and ~CODBC_RowResult().

◆ m_HasMoreData

bool CODBC_RowResult::m_HasMoreData
private

Definition at line 836 of file interfaces.hpp.

Referenced by Fetch(), and ReadItem().

◆ m_LastReadData

string CODBC_RowResult::m_LastReadData
private

Definition at line 835 of file interfaces.hpp.

Referenced by Fetch(), and ReadItem().

◆ m_RowCountPtr

SQLLEN* const CODBC_RowResult::m_RowCountPtr
private

Definition at line 833 of file interfaces.hpp.

Referenced by CODBC_RowResult(), and Fetch().

◆ m_Stmt

CStatementBase& CODBC_RowResult::m_Stmt
private

Definition at line 819 of file interfaces.hpp.

Referenced by GetLastParams(), and GetStatementBase().


The documentation for this class was generated from the following files:
Modified on Tue May 28 05:53:34 2024 by modify_doxy.py rev. 669887