allocator fixes
[csql.git] / include / SqlLogStatement.h
blob8e3bbf87cde81f478e20e8d62dd218e58cd05d8e
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 SQLLOGSTATEMENT_H
21 #define SQLLOGSTATEMENT_H
22 #include <AbsSqlStatement.h>
23 #include <SqlLogConnection.h>
24 #include <SqlFactory.h>
25 #include <CSql.h>
27 class SqlLogStatement: public AbsSqlStatement
29 public:
30 SqlLogStatement() {
31 innerStmt = NULL; con = NULL; needLog= false;
32 sid=0; isNonSelDML = false; isPrepared = false;
33 isCached = false;
34 stmtUID.open();
36 ~SqlLogStatement()
38 if(isPrepared) free(); stmtUID.close();
40 void setConnection(AbsSqlConnection *conn)
42 if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
43 con = conn;
45 AbsSqlStatement *getInnerStatement(){ return innerStmt;}
46 List getTableNameList() { return innerStmt->getTableNameList(); }
47 char *getTableName() { return innerStmt->getTableName(); }
48 bool isNonSelectDML(char *stmtstr);
50 DbRetVal executeDirect(char *stmt);
51 DbRetVal prepare(char *stmt);
53 DbRetVal execute(int &rowsAffect);
54 DbRetVal bindParam(int pos, void*);
56 DbRetVal bindField(int pos, void* val);
58 void* fetch();
59 void* fetch(DbRetVal &rv);
60 void* fetchAndPrint(bool SQL);
61 void* next();
62 DbRetVal close();
63 int noOfProjFields();
65 void* getFieldValuePtr( int pos );
66 void* getFieldValuePtr( char *name );
68 DbRetVal free();
70 int noOfParamFields();
72 DbRetVal getProjFldInfo(int projPos, FieldInfo *&info);
74 DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info);
76 void setShortParam(int paramPos, short value);
77 void setIntParam(int paramPos, int value);
78 void setLongParam(int paramPos, long value);
79 void setLongLongParam(int paramPos, long long value);
80 void setByteIntParam(int paramPos, ByteInt value);
81 void setFloatParam(int paramPos, float value);
82 void setDoubleParam(int paramPos, double value);
83 void setStringParam(int paramPos, char *value);
84 void setDateParam(int paramPos, Date value);
85 void setTimeParam(int paramPos, Time value);
86 void setTimeStampParam(int paramPos, TimeStamp value);
87 void setBinaryParam(int paramPos, void *value, int length);
88 bool isSelect();
89 bool isFldNull(int pos);
90 bool isFldNull(char *name){ return false;}
91 void setNull(int pos);
92 int getFldPos(char *name){ return -1;}
93 List getAllTableNames(DbRetVal &ret);
94 List getAllUserNames(DbRetVal &ret);
95 StatementType getStmtType() { return innerStmt->getStmtType(); }
96 int getNoOfPagesForTable(char *tbl){ return -1;}
97 DbRetVal loadRecords(char *tbl, void *buf){ return ErrBadCall;}
98 ResultSetPlan getResultSetPlan(){ return innerStmt->getResultSetPlan();}
99 long long getLastInsertedVal(DbRetVal &rv){return innerStmt->getLastInsertedVal(rv);}
100 void getProjFieldType(int *data);
101 TableSyncMode mode;
102 bool isNonSelDML;
103 GlobalUniqueID stmtUID;
104 private:
105 bool isPrepared;
106 bool needLog;
107 bool isCached;
108 int sid; //statement id
109 //static UniqueID stmtUID;
110 friend class SqlFactory;
113 #endif