home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qsqlquery.h < prev    next >
C/C++ Source or Header  |  2001-07-26  |  3KB  |  110 lines

  1. /****************************************************************************
  2. **
  3. ** Definition of QSqlQuery class
  4. **
  5. ** Created : 2000-11-03
  6. **
  7. ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
  8. **
  9. ** This file is part of the sql module of the Qt GUI Toolkit.
  10. **
  11. ** This file may be distributed under the terms of the Q Public License
  12. ** as defined by Trolltech AS of Norway and appearing in the file
  13. ** LICENSE.QPL included in the packaging of this file.
  14. **
  15. ** This file may be distributed and/or modified under the terms of the
  16. ** GNU General Public License version 2 as published by the Free Software
  17. ** Foundation and appearing in the file LICENSE.GPL included in the
  18. ** packaging of this file.
  19. **
  20. ** Licensees holding valid Qt Enterprise Edition licenses may use this
  21. ** file in accordance with the Qt Commercial License Agreement provided
  22. ** with the Software.
  23. **
  24. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  25. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  26. **
  27. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  28. **   information about Qt Commercial License Agreements.
  29. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  30. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  31. **
  32. ** Contact info@trolltech.com if any conditions of this licensing are
  33. ** not clear to you.
  34. **
  35. **********************************************************************/
  36.  
  37. #ifndef QSQLQUERY_H
  38. #define QSQLQUERY_H
  39.  
  40. #ifndef QT_H
  41. #include "qobject.h"
  42. #include "qstring.h"
  43. #include "qvariant.h"
  44. #include "qvaluelist.h"
  45. #include "qsqlerror.h"
  46. #include "qsqlfield.h"
  47. #endif // QT_H
  48.  
  49. #ifndef QT_NO_SQL
  50.  
  51. class QSqlDriver;
  52. class QSqlResult;
  53. class QSqlResultInfo;
  54. class QSqlDatabase;
  55.  
  56. class Q_EXPORT QSqlResultShared : public QObject, public QShared
  57. {
  58.     Q_OBJECT
  59. public:
  60.     QSqlResultShared( QSqlResult* result );
  61.     virtual ~QSqlResultShared();
  62.     QSqlResult* sqlResult;
  63. private slots:
  64.     void slotResultDestroyed();
  65. };
  66.  
  67. class Q_EXPORT QSqlQuery
  68. {
  69. public:
  70.     QSqlQuery( QSqlResult * r );
  71.     QSqlQuery( const QString& query = QString::null, QSqlDatabase* db = 0 );
  72.     QSqlQuery( const QSqlQuery& other );
  73.     QSqlQuery&          operator=( const QSqlQuery& other );
  74.     virtual ~QSqlQuery();
  75.  
  76.     bool                isValid() const;
  77.     bool                isActive() const;
  78.     bool            isNull( int field ) const;
  79.     int                 at() const;
  80.     QString             lastQuery() const;
  81.     int                 numRowsAffected() const;
  82.     QSqlError            lastError() const;
  83.     bool                isSelect() const;
  84.     int                 size() const;
  85.     const QSqlDriver*   driver() const;
  86.     const QSqlResult*   result() const;
  87.  
  88.     virtual bool    exec ( const QString& query );
  89.     virtual QVariant    value( int i ) const;
  90.  
  91.     virtual bool    seek( int i, bool relative = FALSE );
  92.     virtual bool        next();
  93.     virtual bool        prev();
  94.     virtual bool        first();
  95.     virtual bool        last();
  96.  
  97. protected:
  98.     virtual void        beforeSeek();
  99.     virtual void        afterSeek();
  100.  
  101. private:
  102.     void                deref();
  103.     bool                checkDetach();
  104.     QSqlResultShared*   d;
  105. };
  106.  
  107.  
  108. #endif // QT_NO_SQL
  109. #endif
  110.