LibEngsas
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
lib
core
esqlfield.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
8
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Lesser General Public License for more details.
13
14
You should have received a copy of the GNU Lesser General Public
15
License along with this library; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
MA 02110-1301 USA.
18
*/
19
20
#ifndef ESQLFIELD_H
21
#define ESQLFIELD_H
22
23
#include "
eglobal.h
"
24
#include "
eobject.h
"
25
26
#include <QString>
27
#include <QVariant>
28
#include <QMultiHash>
29
39
class
E_CORE_EXPORT
ESqlField
:
public
EObject
40
{
41
Q_OBJECT
42
public
:
43
enum
Type
{ NoType, Integer, Text,
Varchar
, Boolean, Date, Time, Tinyint, Double, Timestamp, Blob, LongBlob };
44
45
ESqlField
(QObject* parent = 0);
46
ESqlField
( QString myName,
ESqlField::Type
myType =
ESqlField::NoType
,
bool
notNull =
false
,
bool
autoIncrement =
false
, QObject* parent = 0 );
47
bool
isValid()
const
;
48
QString name()
const
;
49
void
setName ( QString myName );
50
bool
isPrimaryKey()
const
;
51
void
setIsPrimaryKey (
bool
status );
52
bool
autoIncrement()
const
;
53
void
setAutoIncrement (
bool
status );
54
bool
notNull()
const
;
55
void
setNotNull (
bool
status );
56
QVariant defaultValue()
const
;
57
void
setDefaultValue ( QVariant value );
58
ESqlField::Type
dataType()
const
;
59
void
setDataType (
ESqlField::Type
myType );
60
unsigned
int
length()
const
;
61
void
setLength (
unsigned
int
len );
62
bool
isUnsigned()
const
;
63
void
setIsUnsigned (
bool
status );
64
bool
isBinary()
const
;
65
void
setIsBinary (
bool
status );
66
bool
zeroFill()
const
;
67
void
setZeroFill (
bool
status );
68
QString sqlFieldType()
const
;
76
QString createStatement(
EngSaS::SQL::DatabaseType
type);
77
78
ESqlField
*copy()
const
;
79
80
bool
operator== (
const
ESqlField
&field)
const
;
81
bool
operator!= (
const
ESqlField
&field)
const
;
82
83
private
:
84
QString
fieldName
;
85
bool
pk
;
86
bool
ai
;
87
bool
nn
;
88
QVariant
fieldDefValue
;
89
ESqlField::Type
fieldType
;
90
unsigned
int
fieldLength
;
91
bool
binary
;
92
bool
fieldUnsigned
;
93
bool
zf
;
94
QMultiHash<int, QString>
convFieldTypes
;
95
96
void
init();
97
};
98
99
#endif // ESQLFIELD_H
Generated by
1.8.1.2