Main | License | Installation | FAQ | Screenshots | Contact | Links | Sf.net | Freshmeat.net | KDE-Apps.org
Requirements | Design | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ODBCResultRow Class Reference

#include <odbcResultRow.hpp>

Inheritance diagram for ODBCResultRow:

Inheritance graph
[legend]

Public Member Functions

 ODBCResultRow (SQLHSTMT _statement)
virtual std::string operator[] (int i) throw (Error)
virtual void invalidate (void)

Protected Attributes

SQLHSTMT statement

Detailed Description

Class for accessing a single row of an SQL-query's result.
Deprecated:
{The ODBC classes are not in use at the moment}
Date:
Thu Mar 03 2005
Author:
Jan Wedekind (wedesoft@users.sourceforge.net)

Definition at line 27 of file odbcResultRow.hpp.


Constructor & Destructor Documentation

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.

00019                                                  :
00020   statement( aStatement )
00021 {
00022   assert( statement );
00023 }


Member Function Documentation

std::string ODBCResultRow::operator[] ( int  i  )  throw (Error) [virtual]

Operator for retrieving columns.

Parameters:
i Number of column (starting from 0).
See also:
ODBCStatement::getNumCols

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 }

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; }


Field Documentation

SQLHSTMT ODBCResultRow::statement [protected]

Definition at line 43 of file odbcResultRow.hpp.

Referenced by invalidate(), and ODBCResultRow().


The documentation for this class was generated from the following files:

anymeal 0.30 - recipe management software - Make the most of your food! - © Jan Wedekind Wed Sep 26 01:40:32 2007 - GNU Free Documentation License