using tree index
[csql.git] / include / SqlGwStatement.h
blob2dd97c37c855e62728b85246387a9d18a2373fe9
1 /***************************************************************************
2 * Copyright (C) 2007 by Prabakaran Thirumalai *
3 * praba_tuty@yahoo.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef SQLGWSTATEMENT_H
21 #define SQLGWSTATEMENT_H
22 #include <AbsSqlStatement.h>
23 #include <SqlGwConnection.h>
24 #include <SqlFactory.h>
25 #include <CSql.h>
26 class SqlGwStatement: public AbsSqlStatement
28 AbsSqlStatement *adapter;
29 GwHandler stmtHdlr;
30 public:
31 SqlGwStatement(){innerStmt = NULL; adapter = NULL; con = NULL;}
32 void setAdapter(AbsSqlStatement *stmt) { adapter = stmt; }
34 void setConnection(AbsSqlConnection *conn)
36 if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
37 SqlGwConnection *cn = (SqlGwConnection*) conn;
38 if (adapter) adapter->setConnection(cn->getAdapterConnection());
39 con = conn;
42 DbRetVal prepare(char *stmt);
44 DbRetVal execute(int &rowsAffect);
45 DbRetVal bindParam(int pos, void*);
47 DbRetVal bindField(int pos, void* val);
49 void* fetch();
50 void* fetchAndPrint(bool SQL);
51 void* next();
52 DbRetVal close();
53 int noOfProjFields();
55 void* getFieldValuePtr( int pos );
57 DbRetVal free();
59 int noOfParamFields();
61 DbRetVal getProjFldInfo(int projPos, FieldInfo *&info);
63 DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info);
65 void setShortParam(int paramPos, short value);
66 void setIntParam(int paramPos, int value);
67 void setLongParam(int paramPos, long value);
68 void setLongLongParam(int paramPos, long long value);
69 void setByteIntParam(int paramPos, ByteInt value);
70 void setFloatParam(int paramPos, float value);
71 void setDoubleParam(int paramPos, double value);
72 void setStringParam(int paramPos, char *value);
73 void setDateParam(int paramPos, Date value);
74 void setTimeParam(int paramPos, Time value);
75 void setTimeStampParam(int paramPos, TimeStamp value);
76 void setBinaryParam(int paramPos, void *value);
77 bool isSelect();
79 private:
80 bool shouldAdapterHandle();
81 bool shouldCSqlHandle();
82 friend class SqlFactory;
85 #endif