/************************* * * * * * * * * * * * * *************************** Copyright (c) 1999-2005 Ryan Bobko ryan@ostrich-emulators.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************** * * * * * * * * * * * * **************************/ #include "resultset.h" #include "qhaccutils.h" #include "qhacctablerows.h" #include /*****************************************************************/ /* QHACCRESULTSET */ /* This is the basis of all data movement in QHacc. It is an */ /* add-only, dynamically-growing structure. It is how */ /* databases return data to the calling functions */ /* */ /*****************************************************************/ // these are error codes const int QHaccResultSet::VALID=0; const int QHaccResultSet::COLCOUNT=-1; const int QHaccResultSet::UNKNOWN=-2; const int QHaccResultSet::LOWERROR=UNKNOWN; const char * QHaccResultSet::ERRORS[]={ "no error", "column count does not match", "unknown error" }; const char * QHaccResultSet::error( int code ) const { if( coderows(); i++ ) cout<<" "<at( i ).toString()<rows(); startLoad( drows ); for( uint i=0; iat( i ) ); stopLoad(); return true; // always works? } void QHaccResultSet::stopLoad(){ istopLoad(); } void QHaccResultSet::startLoad( uint adds ){ istartLoad( adds ); } void QHaccResultSet::istopLoad(){} void QHaccResultSet::istartLoad( uint ){} void QHaccResultSet::loadRow( const QString& str ) { add( TableRow( str, cols ) ); } bool QHaccResultSet::isEmpty() const { return data.empty(); } uint QHaccResultSet::rows() const { return data.size(); } uint QHaccResultSet::trows() const { return data.capacity(); } uint QHaccResultSet::columns() const { return cols; } ColType QHaccResultSet::coltype( int i ) const { if( i>-1 && i=capacity ) resizeTo( size+growBy ); //cout<<"adding "<" // <