00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __ODBCQUERY_H
00013 #define __ODBCQUERY_H
00014
00015 #include <inttypes.h>
00016 #include <sqltypes.h>
00017 #include <string>
00018
00019 #include <ODBCConnection.h>
00020
00021
00022 using namespace std;
00023
00027 class ODBCQuery
00028 {
00029 public:
00034 ODBCQuery( ODBCConnection &odbc );
00035
00039 ~ODBCQuery();
00040
00044 ODBCQuery ¶m( bool *pValue );
00045
00049 ODBCQuery ¶m( char *pValue );
00050
00054 ODBCQuery ¶m( int *pValue );
00055
00059 ODBCQuery ¶m( int64_t *pValue );
00060
00064 ODBCQuery ¶m( const char *pValue );
00065
00069 ODBCQuery &binParam();
00070
00074 ODBCQuery &column( bool *pValue );
00075
00079 ODBCQuery &column( char *pValue );
00080
00084 ODBCQuery &column( int *pValue );
00085
00089 ODBCQuery &column( int64_t *pValue );
00090
00096 int exec( const char *query );
00097
00102 void listTables();
00103
00108 bool fetch();
00109
00114 bool commit();
00115
00120 bool rollback();
00121
00128 bool getText( int column, string &str );
00129
00137 int getData( int column, uint8_t *buffer, int maxlen );
00138
00145 int putData( const uint8_t *buffer, int length );
00146
00151 int paramData();
00152
00157 void error( int lineno );
00158
00159 private:
00160 ODBCQuery( const ODBCQuery & );
00161 ODBCQuery &operator=( const ODBCQuery & );
00162
00163 ODBCConnection &odbc;
00164 SQLHDBC hdbc;
00165 SQLHSTMT hstmt;
00166 SQLINTEGER binParamLength;
00167 int paramIndex;
00168 int columnIndex;
00169 };
00170
00171 #endif