include/AbsSqlStatement.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Prabakaran Thirumalai   *
00003  *   praba_tuty@yahoo.com   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef ABSSQLSTATEMENT_H
00021 #define ABSSQLSTATEMENT_H
00022 //#include <SqlConnection.h>
00023 //#include "Statement.h"
00024 //#include<CSql.h>
00025 #include<AbsSqlConnection.h>
00026 //#include <SqlStatement.h>
00027 class Statement;
00028 class ParsedData;
00029 
00043 class AbsSqlStatement
00044 {
00045     protected:
00046     AbsSqlStatement(){}
00047     AbsSqlStatement *innerStmt;
00048     AbsSqlConnection *con;
00049     public:
00050     void setInnerStatement(AbsSqlStatement *stmt) { innerStmt = stmt; }
00054     virtual void setConnection(AbsSqlConnection *conn) { con = conn; }
00055 
00063     virtual DbRetVal prepare(char *stmt) = 0;
00064 
00069     virtual char* getTableName(){ return NULL; }
00070 
00078     virtual DbRetVal execute(int &rowsAffect) =0;
00079 
00085     virtual void* fetch() = 0;
00086     
00087 
00093     virtual void* fetchAndPrint(bool SQL) = 0;
00094 
00095 
00106     virtual DbRetVal bindParam(int pos, void*) = 0;
00107 
00120     virtual DbRetVal bindField(int pos, void* val) = 0;
00121 
00125     virtual void* next() = 0;
00126 
00130     virtual DbRetVal close() = 0;
00131 
00135     virtual void* getFieldValuePtr( int pos )  = 0;
00136 
00140     virtual DbRetVal free() = 0;
00141 
00145     virtual int noOfProjFields() = 0;
00146 
00150     virtual int noOfParamFields() = 0;
00151 
00157     virtual DbRetVal getProjFldInfo(int projPos, FieldInfo *&info) = 0;
00158 
00164     virtual DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info) = 0;
00165 
00170     virtual void setShortParam(int paramPos, short value) = 0;
00175     virtual void setIntParam(int paramPos, int value) = 0;
00180     virtual void setLongParam(int paramPos, long value)  =0;
00185     virtual void setLongLongParam(int paramPos, long long value)  =0;
00190     virtual void setByteIntParam(int paramPos, ByteInt value) = 0;
00195     virtual void setFloatParam(int paramPos, float value)  = 0;
00200     virtual void setDoubleParam(int paramPos, double value) = 0;
00205     virtual void setStringParam(int paramPos, char *value) = 0;
00210     virtual void setDateParam(int paramPos, Date value) = 0;
00215     virtual void setTimeParam(int paramPos, Time value) = 0;
00220     virtual void setTimeStampParam(int paramPos, TimeStamp value)  = 0;
00221 
00225     virtual bool isSelect() = 0;
00226     
00227     virtual ~AbsSqlStatement(){}
00228 };
00229 
00230 //used to store the binded field values and parameters from derived clases of
00231 //AbsSqlStatement class
00232 class BindSqlField
00233 {
00234     public:
00235     DataType type;
00236     int length;
00237     void *value;
00238     void *targetvalue;
00239     BindSqlField(){ value = NULL; targetvalue = NULL; }
00240 };
00241 
00242 class BindSqlProjectField
00243 {
00244     public:
00245     char fName[IDENTIFIER_LENGTH];
00246     DataType type;
00247     int length;
00248     void *value;
00249     void *targetvalue;
00250     BindSqlProjectField(){ value = NULL; targetvalue = NULL; }
00251 };
00252 
00253 #endif

Generated on Mon Jun 9 22:37:14 2008 for csql by  doxygen 1.4.7