1 /***************************************************************************
2 * Copyright (C) 2007 by Prabakaran Thirumalai *
3 * praba_tuty@yahoo.com *
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. *
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. *
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
23 #include <AbsSqlStatement.h>
24 #include <SqlNwConnection.h>
25 #include <SqlFactory.h>
27 class DllExport SqlNwStatement
: public AbsSqlStatement
30 SqlNwStatement(){innerStmt
= NULL
; con
= NULL
; isPrepared
=false; isSel
= true; nullInfoDml
= NULL
; nullInfoSel
= NULL
; }
31 void setConnection(AbsSqlConnection
*conn
)
33 if (innerStmt
) innerStmt
->setConnection(conn
->getInnerConnection());
36 ~SqlNwStatement() { if (isPrepared
) free(); }
38 DbRetVal
executeDirect(char *stmt
);
39 DbRetVal
prepare(char *stmt
);
41 DbRetVal
execute(int &rowsAffect
);
42 DbRetVal
bindParam(int pos
, void*);
44 DbRetVal
bindField(int pos
, void* val
);
47 void* fetch(DbRetVal
&rv
);
48 void* fetchAndPrint(bool SQL
);
53 void* getFieldValuePtr( int pos
);
54 void* getFieldValuePtr( char *name
){ return NULL
;}
58 int noOfParamFields();
60 DbRetVal
getProjFldInfo(int projPos
, FieldInfo
*&info
);
62 DbRetVal
getParamFldInfo(int paramPos
, FieldInfo
*&info
);
64 void setShortParam(int paramPos
, short value
);
65 void setIntParam(int paramPos
, int value
);
66 void setLongParam(int paramPos
, long value
);
67 void setLongLongParam(int paramPos
, long long value
);
68 void setByteIntParam(int paramPos
, ByteInt value
);
69 void setFloatParam(int paramPos
, float value
);
70 void setDoubleParam(int paramPos
, double value
);
71 void setStringParam(int paramPos
, char *value
);
72 void setDateParam(int paramPos
, Date value
);
73 void setTimeParam(int paramPos
, Time value
);
74 void setTimeStampParam(int paramPos
, TimeStamp value
);
75 void setBinaryParam(int paramPos
, void *value
, int length
);
76 bool isSelect(){return isSel
;}
77 void getPrimaryKeyFieldName(char *tablename
, char *pkfieldname
);
78 int getStmtID() { return stmtID
; }
79 bool isFldNull(int pos
);
80 bool isFldNull(char *name
);
81 void setNull(int pos
);
82 void setStmtID(int id
) { stmtID
= id
; }
83 int getFldPos(char *name
){ return -1;}
84 List
getAllTableNames(DbRetVal
&ret
);
85 List
getAllUserNames(DbRetVal
&ret
){ List dummy
; return dummy
;}
86 char *getTableName(){ return "";}
87 StatementType
getStmtType() { return UnknownStatement
; }
88 int getNoOfPagesForTable(char *tbl
){ return -1;}
89 bool isTablePresent(char *tbName
, DbRetVal
&rv
);
90 void *getLoadedRecords(char *tbName
, DbRetVal
&rv
);
91 DbRetVal
loadRecords(char *tbName
, void *buf
){ return ErrBadCall
;}
92 ResultSetPlan
getResultSetPlan() { return plan
;}
93 bool isPrepd() { return isPrepared
; }
94 void getProjFieldType(int *data
);
95 long long getLastInsertedVal(DbRetVal
&rv
);
106 char *nullInfoSel
; // for nullinfo in fetch
107 char *nullInfoDml
; // for nullinfo in insert and update
108 friend class SqlFactory
;