allocator fixes
[csql.git] / include / SqlOdbcStatement.h
blobf948c6c2f10c16d6c6686ab9101b8bfdaf4c86d5
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 SQLODBCSTATEMENT_H
21 #define SQLODBCSTATEMENT_H
22 #include <AbsSqlStatement.h>
23 #include <SqlOdbcConnection.h>
24 #include <SqlFactory.h>
25 #include <CSql.h>
26 class SqlOdbcStatement: public AbsSqlStatement
28 public:
29 SqlOdbcStatement() { innerStmt = NULL; con = NULL; isSelStmt = false; len=NULL; paramlen=NULL; isPrepared = false; strcpy(errState,"00000");}
31 void setConnection(AbsSqlConnection *conn)
33 if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
34 con = conn;
37 DbRetVal executeDirect(char *stmt);
38 DbRetVal prepare(char *stmt);
40 DbRetVal execute(int &rowsAffect);
41 DbRetVal bindParam(int pos, void*);
43 DbRetVal bindField(int pos, void* val);
45 void* fetch();
46 void* fetch(DbRetVal &rv);
47 void* fetchAndPrint(bool SQL);
48 void* next();
49 DbRetVal close();
50 int noOfProjFields();
52 void* getFieldValuePtr( int pos );
53 void* getFieldValuePtr( char *name );
55 DbRetVal free();
57 int noOfParamFields();
59 DbRetVal getProjFldInfo(int projPos, FieldInfo *&info);
61 DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info);
63 void setShortParam(int paramPos, short value);
64 void setIntParam(int paramPos, int value);
65 void setLongParam(int paramPos, long value);
66 void setLongLongParam(int paramPos, long long value);
67 void setByteIntParam(int paramPos, ByteInt value);
68 void setFloatParam(int paramPos, float value);
69 void setDoubleParam(int paramPos, double value);
70 void setStringParam(int paramPos, char *value);
71 void setDateParam(int paramPos, Date value);
72 void setTimeParam(int paramPos, Time value);
73 void setTimeStampParam(int paramPos, TimeStamp value);
74 void setBinaryParam(int paramPos, void *value, int length);
75 bool isSelect();
76 void getPrimaryKeyFieldName(char *tablename, char *pkfieldname);
77 void setNullInfo(AbsSqlStatement *stmt);
78 // void setNullInfo(Table *stmt);
79 bool isFldNull(int pos);
80 bool isFldNull(char *name);
81 bool chechStmtType(char *stmtstr);
82 void setNull(int pos);
83 int getFldPos(char *name){ return 0;}
84 List getAllTableNames(DbRetVal &ret){ List dummy; return dummy;}
85 List getAllUserNames(DbRetVal &ret){ List dummy; return dummy;}
86 bool isTableExists(char *tblname);
87 int getNoOfPagesForTable(char *tbl){ return 0;}
88 DbRetVal loadRecords(char *tbl, void *buf){ return ErrBadCall;}
89 ResultSetPlan getResultSetPlan(){ return Normal;}
90 char *getTableName(){ return "";}
91 StatementType getStmtType() { return UnknownStatement; }
92 void setErrorState(SQLHSTMT hStmt);
93 DbRetVal resolveForBindField(SQLHSTMT hstmt);
94 void getProjFieldType(int *data);
95 long long getLastInsertedVal(DbRetVal &rv){ rv = ErrBadCall; return 0;} //TODO
96 private:
97 char errState[STATE_LENGTH];
98 TDBInfo tdbname;
99 bool isSelStmt;
100 bool isPrepared;
101 List paramList;
102 List bindList;
103 SQLHSTMT hstmt;
104 SQLINTEGER *len;
105 SQLINTEGER *paramlen;
106 int totalFld;
107 bool isProcedureCallStmt;
108 friend class SqlFactory;
111 #endif