kword

KWMySqlCursor.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _SERIALLETTER_QtSql_SQLCURSOR_H_
00021 #define _SERIALLETTER_QtSql_SQLCURSOR_H_
00022 
00023 /* FOR THE DIRTY HACK */
00024 #include <qsqlcursor.h>
00025 #include <qsqldriver.h>
00026 /* END FOR THE DIRTY HACK */
00027 
00028 /******************************************************************
00029  *
00030  * DIRTY HACK FOR SOME INFLEXIBILITY IN QT3's SQL stuff
00031  *
00032  * This class is rom some Trolltech guy on QT-interest
00033  ******************************************************************/
00034 
00035 
00036 
00037 class KWMySqlCursor: public QSqlCursor
00038 {
00039 public:
00040     KWMySqlCursor( const QString & query = QString::null, bool autopopulate = 
00041 TRUE, QSqlDatabase* db = 0 ): QSqlCursor( QString::null, autopopulate, db )
00042     {
00043         exec( query );
00044         if ( autopopulate )
00045             *(QSqlRecord*)this = ((QSqlQuery*)this)->driver()->record(
00046 *(QSqlQuery*)this );
00047         setMode( QSqlCursor::ReadOnly );
00048     }
00049     KWMySqlCursor( const KWMySqlCursor & other ): QSqlCursor( other ) {}
00050     KWMySqlCursor( const QSqlQuery & query, bool autopopulate = TRUE ): 
00051 QSqlCursor( QString::null, autopopulate )
00052     {
00053         *(QSqlQuery*)this = query;
00054         if ( autopopulate )
00055             *(QSqlRecord*)this = query.driver()->record( query );
00056         setMode( QSqlCursor::ReadOnly );
00057     }
00058     bool select( const QString & /*filter*/, const QSqlIndex & /*sort*/ = 
00059 QSqlIndex() ) { return exec( lastQuery() ); }
00060     QSqlIndex primaryIndex( bool /*prime*/ = TRUE ) const { return
00061 QSqlIndex(); }
00062     int insert( bool /*invalidate*/ = TRUE ) { return FALSE; }
00063     int update( bool /*invalidate*/ = TRUE ) { return FALSE; }
00064     int del( bool /*invalidate*/ = TRUE ) { return FALSE; }
00065     void setName( const QString& /*name*/, bool /*autopopulate*/ = TRUE ) {}
00066 };
00067 
00068 
00069 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys