00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SQLGWSTATEMENT_H
00021 #define SQLGWSTATEMENT_H
00022 #include <AbsSqlStatement.h>
00023 #include <SqlGwConnection.h>
00024 #include <SqlFactory.h>
00025 #include <CSql.h>
00026 class SqlGwStatement: public AbsSqlStatement
00027 {
00028 AbsSqlStatement *adapter;
00029 GwHandler stmtHdlr;
00030 public:
00031 SqlGwStatement(){innerStmt = NULL; adapter = NULL; con = NULL;}
00032 void setAdapter(AbsSqlStatement *stmt) { adapter = stmt; }
00033
00034 void setConnection(AbsSqlConnection *conn)
00035 {
00036 if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
00037 SqlGwConnection *cn = (SqlGwConnection*) conn;
00038 if (adapter) adapter->setConnection(cn->getAdapterConnection());
00039 con = conn;
00040 }
00041
00042 DbRetVal prepare(char *stmt);
00043
00044 DbRetVal execute(int &rowsAffect);
00045 DbRetVal bindParam(int pos, void*);
00046
00047 DbRetVal bindField(int pos, void* val);
00048
00049 void* fetch();
00050 void* fetchAndPrint(bool SQL);
00051 void* next();
00052 DbRetVal close();
00053 int noOfProjFields();
00054
00055 void* getFieldValuePtr( int pos );
00056
00057 DbRetVal free();
00058
00059 int noOfParamFields();
00060
00061 DbRetVal getProjFldInfo(int projPos, FieldInfo *&info);
00062
00063 DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info);
00064
00065 void setShortParam(int paramPos, short value);
00066 void setIntParam(int paramPos, int value);
00067 void setLongParam(int paramPos, long value);
00068 void setLongLongParam(int paramPos, long long value);
00069 void setByteIntParam(int paramPos, ByteInt value);
00070 void setFloatParam(int paramPos, float value);
00071 void setDoubleParam(int paramPos, double value);
00072 void setStringParam(int paramPos, char *value);
00073 void setDateParam(int paramPos, Date value);
00074 void setTimeParam(int paramPos, Time value);
00075 void setTimeStampParam(int paramPos, TimeStamp value);
00076 bool isSelect();
00077
00078 private:
00079 bool shouldAdapterHandle();
00080 bool shouldCSqlHandle();
00081 friend class SqlFactory;
00082 };
00083
00084 #endif