include/SqlStatement.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 SQLSTATEMENT_H
00021 #define SQLSTATEMENT_H
00022 #include <AbsSqlStatement.h>
00023 #include <SqlConnection.h>
00024 #include <SqlFactory.h>
00025 #include "Statement.h"
00026 //#include<CSql.h>
00027 class Statement;
00028 class ParsedData;
00029 
00030 class SqlStatement: public AbsSqlStatement
00031 {
00032     public:
00033     SqlStatement();
00037     void setConnection(AbsSqlConnection *con);
00038     void setSqlConnection(SqlConnection *con);
00039 
00047     DbRetVal prepare(char *stmt);
00048 
00049     char* getTableName();
00050 
00058     DbRetVal execute(int &rowsAffect);
00059 
00065     void* fetch();
00066     void* fetch(DbRetVal &rv);
00067     
00068 
00074     void* fetchAndPrint(bool SQL);
00075 
00076 
00087     DbRetVal bindParam(int pos, void*);
00088 
00101     DbRetVal bindField(int pos, void* val);
00102 
00106     void* next();
00107 
00111     DbRetVal close();
00112 
00116     void* getFieldValuePtr( int pos );
00117 
00121     DbRetVal free();
00122 
00126     int noOfProjFields();
00127 
00131      void* getParamValuePtr( int pos );
00132 
00136      DataType getFieldType( int pos );
00137 
00141      int getFieldLength( int pos );
00142 
00146      char* getFieldName ( int pos );
00147 
00151     int noOfParamFields();
00152 
00158     DbRetVal getProjFldInfo(int projPos, FieldInfo *&info);
00159 
00165     DbRetVal getParamFldInfo(int paramPos, FieldInfo *&info);
00166 
00171     void setShortParam(int paramPos, short value);
00176     void setIntParam(int paramPos, int value);
00181     void setLongParam(int paramPos, long value);
00186     void setLongLongParam(int paramPos, long long value);
00191     void setByteIntParam(int paramPos, ByteInt value);
00196     void setFloatParam(int paramPos, float value);
00201     void setDoubleParam(int paramPos, double value);
00206     void setStringParam(int paramPos, char *value);
00211     void setDateParam(int paramPos, Date value);
00216     void setTimeParam(int paramPos, Time value);
00221     void setTimeStampParam(int paramPos, TimeStamp value);
00222 
00226     bool isSelect();
00227     
00231     bool isPrepared();
00232 
00233     private:
00234     SqlConnection *sqlCon;
00235     Statement *stmt;
00236     ParsedData pData;
00237     bool isPrepd;
00238     friend class SqlFactory;
00239 };
00240 
00241 #endif

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