1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
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.
27
****************************************************************************/
29
#ifndef Q3SQLFIELDINFO_H
30
#define Q3SQLFIELDINFO_H
34
#include "QtCore/qglobal.h"
35
#include "QtSql/qsqlfield.h"
37
/* Q3SqlFieldInfo Class
38
obsoleted, use QSqlField instead
41
class Q_COMPAT_EXPORT Q3SqlFieldInfo
43
// class is obsoleted, won't change anyways,
45
int req, len, prec, tID;
54
Q3SqlFieldInfo(const QString& name = QString(),
55
QVariant::Type typ = QVariant::Invalid,
59
const QVariant& defValue = QVariant(),
61
bool generated = true,
63
bool calculated = false) :
64
req(required), len(len), prec(prec), tID(sqlType),
65
gen(generated), trim(trim), calc(calculated),
66
nm(name), typ(typ), defValue(defValue) {}
68
virtual ~Q3SqlFieldInfo() {}
70
Q3SqlFieldInfo(const QSqlField & other)
74
switch (other.requiredStatus()) {
75
case QSqlField::Unknown: req = -1; break;
76
case QSqlField::Required: req = 1; break;
77
case QSqlField::Optional: req = 0; break;
80
prec = other.precision();
81
defValue = other.defaultValue();
83
gen = other.isGenerated();
88
bool operator==(const Q3SqlFieldInfo& f) const
95
defValue == f.defValue &&
102
QSqlField toField() const
103
{ QSqlField f(nm, typ);
104
f.setRequiredStatus(QSqlField::RequiredStatus(req));
106
f.setPrecision(prec);
107
f.setDefaultValue(defValue);
112
int isRequired() const
114
QVariant::Type type() const
118
int precision() const
120
QVariant defaultValue() const
126
bool isGenerated() const
130
bool isCalculated() const
133
virtual void setTrim(bool trim)
134
{ this->trim = trim; }
135
virtual void setGenerated(bool generated)
137
virtual void setCalculated(bool calculated)
138
{ calc = calculated; }