Eneboo - Documentación para desarrolladores
src/qt/src/sql/qsqlrecord.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 **
00003 ** Definition of QSqlRecord class
00004 **
00005 ** Created : 2000-11-03
00006 **
00007 ** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
00008 **
00009 ** This file is part of the sql module of the Qt GUI Toolkit.
00010 **
00011 ** This file may be distributed under the terms of the Q Public License
00012 ** as defined by Trolltech ASA of Norway and appearing in the file
00013 ** LICENSE.QPL included in the packaging of this file.
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00021 ** file in accordance with the Qt Commercial License Agreement provided
00022 ** with the Software.
00023 **
00024 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00025 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00026 **
00027 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00028 **   information about Qt Commercial License Agreements.
00029 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00030 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00031 **
00032 ** Contact info@trolltech.com if any conditions of this licensing are
00033 ** not clear to you.
00034 **
00035 **********************************************************************/
00036 
00037 #ifndef QSQLRECORD_H
00038 #define QSQLRECORD_H
00039 
00040 #ifndef QT_H
00041 #include "qstring.h"
00042 #include "qstringlist.h"
00043 #include "qvariant.h"
00044 #include "qsqlfield.h"
00045 #endif // QT_H
00046 
00047 #ifndef QT_NO_SQL
00048 
00049 class QSqlRecordPrivate;
00050 
00051 class QSqlRecordShared : public QShared
00052 {
00053 public:
00054     QSqlRecordShared( QSqlRecordPrivate* sqlRecordPrivate )
00055     : d( sqlRecordPrivate )
00056     {}
00057     virtual ~QSqlRecordShared();
00058     QSqlRecordPrivate* d;
00059 };
00060 
00061 class Q_EXPORT QSqlRecord
00062 {
00063 public:
00064     QSqlRecord();
00065     QSqlRecord( const QSqlRecord& other );
00066     QSqlRecord& operator=( const QSqlRecord& other );
00067     virtual ~QSqlRecord();
00068     virtual QVariant     value( int i ) const;
00069     virtual QVariant     value( const QString& name ) const;
00070     virtual void         setValue( int i, const QVariant& val );
00071     virtual void         setValue( const QString& name, const QVariant& val );
00072     bool                 isGenerated( int i ) const;
00073     bool                 isGenerated( const QString& name ) const;
00074     virtual void         setGenerated( const QString& name, bool generated );
00075     virtual void         setGenerated( int i, bool generated );
00076     virtual void         setNull( int i );
00077     virtual void         setNull( const QString& name );
00078     bool                 isNull( int i ); // remove in 4.0
00079     bool                 isNull( const QString& name ); // remove in 4.0
00080     bool                 isNull( int i ) const;
00081     bool                 isNull( const QString& name ) const;
00082 
00083     int                  position( const QString& name ) const;
00084     QString              fieldName( int i ) const;
00085     QSqlField*           field( int i );
00086     QSqlField*           field( const QString& name );
00087     const QSqlField*     field( int i ) const;
00088     const QSqlField*     field( const QString& name ) const;
00089 
00090     virtual void         append( const QSqlField& field );
00091     virtual void         insert( int pos, const QSqlField& field );
00092     virtual void         remove( int pos );
00093 
00094     bool                 isEmpty() const;
00095     bool                 contains( const QString& name ) const;
00096     virtual void         clear();
00097     virtual void         clearValues( bool nullify = FALSE );
00098     uint                 count() const;
00099     virtual QString      toString( const QString& prefix = QString::null,
00100                                    const QString& sep = "," ) const;
00101     virtual QStringList  toStringList( const QString& prefix = QString::null ) const;
00102 
00103 private:
00104     QString              createField( int i, const QString& prefix ) const;
00105     void                 deref();
00106     bool                 checkDetach();
00107     QSqlRecordShared*    sh;
00108 };
00109 
00110 /******************************************/
00111 /*******     QSqlRecordInfo Class    ******/
00112 /******************************************/
00113 
00114 #if defined(Q_TEMPLATEDLL)
00115 // MOC_SKIP_BEGIN
00116 Q_TEMPLATE_EXTERN template class Q_EXPORT QValueList<QSqlFieldInfo>;
00117 // MOC_SKIP_END
00118 #endif
00119 
00120 typedef QValueList<QSqlFieldInfo> QSqlFieldInfoList;
00121 
00122 class Q_EXPORT QSqlRecordInfo: public QSqlFieldInfoList
00123 {
00124 public:
00125     QSqlRecordInfo(): QSqlFieldInfoList() {}
00126     QSqlRecordInfo( const QSqlFieldInfoList& other ): QSqlFieldInfoList( other ) {}
00127     QSqlRecordInfo( const QSqlRecord& other );
00128 
00129     size_type contains( const QString& fieldName ) const;
00130     QSqlFieldInfo find( const QString& fieldName ) const;
00131     QSqlRecord toRecord() const;
00132 
00133 };
00134 
00135 
00136 #endif  // QT_NO_SQL
00137 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'