#include <odbcResultRow.hpp>

Public Member Functions | |
| ODBCResultRow (SQLHSTMT _statement) | |
| virtual std::string | operator[] (int i) throw (Error) |
| virtual void | invalidate (void) |
Protected Attributes | |
| SQLHSTMT | statement |
Class for accessing a single row of an SQL-query's result.
Definition at line 27 of file odbcResultRow.hpp.
| ODBCResultRow::ODBCResultRow | ( | SQLHSTMT | _statement | ) |
Constructor requiring a statement handle. Use ODBCStatement::fetchRow instead of this constructor.
Definition at line 19 of file odbcResultRow.cpp.
References statement.
| virtual void ODBCResultRow::invalidate | ( | void | ) | [inline, virtual] |
Invalidate the row. This method is called by the destructor of ODBCStatement to prevent the ODBCResultRow object from using an invalid SQL-query handle.
Implements ResultRow.
Definition at line 40 of file odbcResultRow.hpp.
References statement.
00040 { statement = NULL; }
| std::string ODBCResultRow::operator[] | ( | int | i | ) | throw (Error) [virtual] |
Operator for retrieving columns.
| i | Number of column (starting from 0). |
Implements ResultRow.
Definition at line 25 of file odbcResultRow.cpp.
References ERRORMACRO.
00026 { 00027 ERRORMACRO( statement != NULL, Error, , 00028 "Handle of SQL-query was invalidated. Probably " 00029 "ODBCStatement::~ODBCStatement called before finishing " 00030 "reading out the results." ); 00031 SQLCHAR result[ 65536 ]; 00032 #ifdef SQLLEN 00033 SQLLEN length; 00034 #else 00035 long length; 00036 #endif 00037 00038 SQLGetData( statement, i + 1, SQL_C_CHAR, (SQLPOINTER)result, 00039 sizeof(result), &length ); 00040 assert( length < (signed)sizeof(result) ); 00041 00042 assert( sizeof(SQLCHAR) == sizeof(char) ); 00043 if ( length != SQL_NULL_DATA ) 00044 return std::string( (char *)result ); 00045 else 00046 return std::string(); 00047 }
SQLHSTMT ODBCResultRow::statement [protected] |
Definition at line 43 of file odbcResultRow.hpp.
Referenced by invalidate(), and ODBCResultRow().