1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Definition of QSqlIndex class
|
---|
4 | **
|
---|
5 | ** Created : 2000-11-03
|
---|
6 | **
|
---|
7 | ** Copyright (C) 2005-2007 Trolltech ASA. 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 ASA 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 QSQLINDEX_H
|
---|
38 | #define QSQLINDEX_H
|
---|
39 |
|
---|
40 | #ifndef QT_H
|
---|
41 | #include "qstring.h"
|
---|
42 | #include "qstringlist.h"
|
---|
43 | #include "qsqlfield.h"
|
---|
44 | #include "qsqlrecord.h"
|
---|
45 | #endif // QT_H
|
---|
46 |
|
---|
47 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
|
---|
48 | #define QM_EXPORT_SQL
|
---|
49 | #define QM_TEMPLATE_EXTERN_SQL
|
---|
50 | #else
|
---|
51 | #define QM_EXPORT_SQL Q_EXPORT
|
---|
52 | #define QM_TEMPLATE_EXTERN_SQL Q_TEMPLATE_EXTERN
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #ifndef QT_NO_SQL
|
---|
56 |
|
---|
57 | class QSqlCursor;
|
---|
58 |
|
---|
59 | class QM_EXPORT_SQL QSqlIndex : public QSqlRecord
|
---|
60 | {
|
---|
61 | public:
|
---|
62 | QSqlIndex( const QString& cursorName = QString::null, const QString& name = QString::null );
|
---|
63 | QSqlIndex( const QSqlIndex& other );
|
---|
64 | ~QSqlIndex();
|
---|
65 | QSqlIndex& operator=( const QSqlIndex& other );
|
---|
66 | virtual void setCursorName( const QString& cursorName );
|
---|
67 | QString cursorName() const { return cursor; }
|
---|
68 | virtual void setName( const QString& name );
|
---|
69 | QString name() const { return nm; }
|
---|
70 |
|
---|
71 | void append( const QSqlField& field );
|
---|
72 | virtual void append( const QSqlField& field, bool desc );
|
---|
73 |
|
---|
74 | bool isDescending( int i ) const;
|
---|
75 | virtual void setDescending( int i, bool desc );
|
---|
76 |
|
---|
77 | QString toString( const QString& prefix = QString::null,
|
---|
78 | const QString& sep = ",",
|
---|
79 | bool verbose = TRUE ) const;
|
---|
80 | QStringList toStringList( const QString& prefix = QString::null,
|
---|
81 | bool verbose = TRUE ) const;
|
---|
82 |
|
---|
83 | static QSqlIndex fromStringList( const QStringList& l, const QSqlCursor* cursor );
|
---|
84 |
|
---|
85 | private:
|
---|
86 | QString createField( int i, const QString& prefix, bool verbose ) const;
|
---|
87 | QString cursor;
|
---|
88 | QString nm;
|
---|
89 | QValueList<bool> sorts;
|
---|
90 | };
|
---|
91 |
|
---|
92 | #define Q_DEFINED_QSQLINDEX
|
---|
93 | #include "qwinexport.h"
|
---|
94 | #endif // QT_NO_SQL
|
---|
95 | #endif
|
---|