WORM 0.2
A C++ DAL/ORM code generation framework

src/sql/drivers/wmysqlresult.h

Go to the documentation of this file.
00001 /*
00002     WORM - a DAL/ORM code generation framework
00003     Copyright (C) 2011  Erik Winn <erikwinnmail@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 3 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, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef WMYSQLRESULT_H
00021 #define WMYSQLRESULT_H
00022 
00023 #include "wsqlresult.h"
00024 #include <mysql/mysql.h>
00025 
00026 namespace WSql
00027 {
00028  
00029 class WMysqlResult : public WSqlResult
00030 {
00031 
00032     public:
00033         WMysqlResult( const WSql::WSqlDriver* driver );
00034 //        WMysqlResult( const WMysqlResult& other );
00035         ~WMysqlResult();
00036 //        WMysqlResult& operator=( const WMysqlResult& other );
00037 //        bool operator==( const WMysqlResult& other ) const;
00038         
00039         void addRecord( WSqlRecord& r ) {_records.push_back( r );}
00040         void setIsCached( bool b ) { _isCached = b; }
00041 
00042         bool isCached() {return _isCached; }
00043         int size()const {return _records.size(); }
00044         int count()const {return size(); }
00045         bool empty()const { return _records.empty();}
00046         bool hasOutValues() const { return !empty();}
00047 
00048         void clear() { _records.clear(); }
00049 
00050         WSqlRecord current();
00051         WSqlRecord fetch( int i = -1 );
00052         WSqlRecord fetchFirst();
00053         WSqlRecord fetchLast();
00054         WSqlRecord fetchNext();
00055         WSqlRecord fetchPrevious();
00056 
00057     protected:
00058         
00059         bool seek( int i, bool relative = false );
00060         bool next();
00061         bool previous();
00062         bool first();
00063         bool last();
00064 
00065 
00066     private:
00067         friend class WMysqlDriver;
00068         void freegetResult();
00069         void setResult(MYSQL_RES *res){_mysqlResult = res;}
00070         MYSQL_RES * getResult(){return _mysqlResult;};
00071         MYSQL_RES *_mysqlResult;
00072 };
00073 
00074 } //namespace WSql
00075 
00076 #endif // WMYSQLRESULT_H
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines