~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/plugins/scripting/kexidb/kexidbfield.cpp

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
ImportĀ upstreamĀ versionĀ 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 * kexidbfield.cpp
 
3
 * This file is part of the KDE project
 
4
 * copyright (C)2004-2006 by Sebastian Sauer (mail@dipe.org)
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Library General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Library General Public License for more details.
 
14
 * You should have received a copy of the GNU Library General Public License
 
15
 * along with this program; see the file COPYING.  If not, write to
 
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 * Boston, MA 02110-1301, USA.
 
18
 ***************************************************************************/
 
19
 
 
20
 
 
21
#include "kexidbfield.h"
 
22
 
 
23
using namespace Scripting;
 
24
 
 
25
KexiDBField::KexiDBField(QObject* parent, KDbField* field, bool owner)
 
26
        : QObject(parent)
 
27
        , m_field(field)
 
28
        , m_owner(owner)
 
29
{
 
30
    setObjectName("KexiDBField");
 
31
}
 
32
 
 
33
KexiDBField::~KexiDBField()
 
34
{
 
35
    if (m_owner)
 
36
        delete m_field;
 
37
}
 
38
 
 
39
const QString KexiDBField::type()
 
40
{
 
41
    return m_field->typeString();
 
42
}
 
43
void KexiDBField::setType(const QString type)
 
44
{
 
45
    m_field->setType(KDbField::typeForString(type));
 
46
}
 
47
 
 
48
const QString KexiDBField::subType()
 
49
{
 
50
    return m_field->subType();
 
51
}
 
52
void KexiDBField::setSubType(const QString& subtype)
 
53
{
 
54
    m_field->setSubType(subtype);
 
55
}
 
56
 
 
57
const QString KexiDBField::variantType()
 
58
{
 
59
    return QVariant::typeToName(m_field->variantType());
 
60
}
 
61
const QString KexiDBField::typeGroup()
 
62
{
 
63
    return m_field->typeGroupString();
 
64
}
 
65
 
 
66
bool KexiDBField::isAutoInc()
 
67
{
 
68
    return m_field->isAutoIncrement();
 
69
}
 
70
void KexiDBField::setAutoInc(bool autoinc)
 
71
{
 
72
    m_field->setAutoIncrement(autoinc);
 
73
}
 
74
 
 
75
bool KexiDBField::isUniqueKey()
 
76
{
 
77
    return m_field->isUniqueKey();
 
78
}
 
79
void KexiDBField::setUniqueKey(bool unique)
 
80
{
 
81
    m_field->setUniqueKey(unique);
 
82
}
 
83
 
 
84
bool KexiDBField::isPrimaryKey()
 
85
{
 
86
    return m_field->isPrimaryKey();
 
87
}
 
88
void KexiDBField::setPrimaryKey(bool primary)
 
89
{
 
90
    m_field->setPrimaryKey(primary);
 
91
}
 
92
 
 
93
bool KexiDBField::isForeignKey()
 
94
{
 
95
    return m_field->isForeignKey();
 
96
}
 
97
void KexiDBField::setForeignKey(bool foreign)
 
98
{
 
99
    m_field->setForeignKey(foreign);
 
100
}
 
101
 
 
102
bool KexiDBField::isNotNull()
 
103
{
 
104
    return m_field->isNotNull();
 
105
}
 
106
void KexiDBField::setNotNull(bool notnull)
 
107
{
 
108
    m_field->setNotNull(notnull);
 
109
}
 
110
 
 
111
bool KexiDBField::isNotEmpty()
 
112
{
 
113
    return m_field->isNotEmpty();
 
114
}
 
115
void KexiDBField::setNotEmpty(bool notempty)
 
116
{
 
117
    m_field->setNotEmpty(notempty);
 
118
}
 
119
 
 
120
bool KexiDBField::isIndexed()
 
121
{
 
122
    return m_field->isIndexed();
 
123
}
 
124
void KexiDBField::setIndexed(bool indexed)
 
125
{
 
126
    m_field->setIndexed(indexed);
 
127
}
 
128
 
 
129
bool KexiDBField::isUnsigned()
 
130
{
 
131
    return m_field->isUnsigned();
 
132
}
 
133
void KexiDBField::setUnsigned(bool isunsigned)
 
134
{
 
135
    m_field->setUnsigned(isunsigned);
 
136
}
 
137
 
 
138
const QString KexiDBField::name()
 
139
{
 
140
    return m_field->name();
 
141
}
 
142
void KexiDBField::setName(const QString& name)
 
143
{
 
144
    m_field->setName(name);
 
145
}
 
146
 
 
147
const QString KexiDBField::caption()
 
148
{
 
149
    return m_field->caption();
 
150
}
 
151
 
 
152
void KexiDBField::setCaption(const QString& caption)
 
153
{
 
154
    m_field->setCaption(caption);
 
155
}
 
156
 
 
157
const QString KexiDBField::description()
 
158
{
 
159
    return m_field->description();
 
160
}
 
161
void KexiDBField::setDescription(const QString& desc)
 
162
{
 
163
    m_field->setDescription(desc);
 
164
}
 
165
 
 
166
int KexiDBField::length()
 
167
{
 
168
    return m_field->maxLength();
 
169
}
 
170
 
 
171
void KexiDBField::setLength(int length)
 
172
{
 
173
    m_field->setMaxLength(length);
 
174
}
 
175
 
 
176
int KexiDBField::precision()
 
177
{
 
178
    return m_field->precision();
 
179
}
 
180
void KexiDBField::setPrecision(int precision)
 
181
{
 
182
    m_field->setPrecision(precision);
 
183
}
 
184
 
 
185
QVariant KexiDBField::defaultValue()
 
186
{
 
187
    return m_field->defaultValue();
 
188
}
 
189
void KexiDBField::setDefaultValue(const QVariant& defaultvalue)
 
190
{
 
191
    m_field->setDefaultValue(defaultvalue);
 
192
}
 
193