fix for trie index
[csql.git] / include / SqlNwStatement.h
blobfa5855b710639ff3e61d19ddfb61d001b106a404
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 SQLNWSTATEMENT_H
21 #define SQLNWSTATEMENT_H
22 #include <os.h>
23 #include <AbsSqlStatement.h>
24 #include <SqlNwConnection.h>
25 #include <SqlFactory.h>
26 #include <CSql.h>
27 class DllExport SqlNwStatement: public AbsSqlStatement
29 public:
30 SqlNwStatement(){innerStmt = NULL; con = NULL; isPrepared=false;
31 isSel = true; nullInfoDml = NULL; nullInfoSel = NULL; }
32 void setConnection(AbsSqlConnection *conn)
34 if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
35 con = conn;
37 ~SqlNwStatement() { if (isPrepared) free(); }
39 DbRetVal executeDirect(char *stmt);
40 DbRetVal prepare(char *stmt);
42 DbRetVal execute(int &rowsAffect);
43 DbRetVal bindParam(int pos, void*);
45 DbRetVal bindField(int pos, void* val);
47 void* fetch();
48 void* fetch(DbRetVal &rv);
49 void* fetchAndPrint(bool SQL);
50 void* next();
51 DbRetVal close();
52 int noOfProjFields();
54 void* getFieldValuePtr( int pos );
55 void* getFieldValuePtr( char *name ){ return NULL;}
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, int length);
77 bool isSelect(){return isSel;}
78 void getPrimaryKeyFieldName(char *tablename, char *pkfieldname);
79 int getStmtID() { return stmtID; }
80 bool isFldNull(int pos);
81 bool isFldNull(char *name);
82 void setNull(int pos);
83 void setStmtID(int id) { stmtID = id; }
84 int getFldPos(char *name){ return -1;}
85 List getAllTableNames(DbRetVal &ret);
86 List getAllUserNames(DbRetVal &ret){ List dummy; return dummy;}
87 char *getTableName(){ return "";}
88 StatementType getStmtType() { return UnknownStatement; }
89 int getNoOfPagesForTable(char *tbl){ return -1;}
90 bool isTablePresent(char *tbName, DbRetVal &rv);
91 void *getLoadedRecords(char *tbName, DbRetVal &rv);
92 DbRetVal loadRecords(char *tbName, void *buf){ return ErrBadCall;}
93 ResultSetPlan getResultSetPlan() { return plan;}
94 bool isPrepd() { return isPrepared; }
95 void getProjFieldType(int *data);
96 long long getLastInsertedVal(DbRetVal &rv);
97 private:
98 ResultSetPlan plan;
99 bool isPrepared;
100 bool isSel;
101 int stmtID;
102 List paramList;
103 int noOfParams;
104 List bindList;
105 List tblNameList;
106 int noOfProjs;
107 char *nullInfoSel; // for nullinfo in fetch
108 char *nullInfoDml; // for nullinfo in insert and update
109 friend class SqlFactory;
112 #endif