29#include <QCoreApplication>
80 typedef QPair<KDbField*, KDbField*>
Pair;
113 LastSpecialType = Tuple
142 Q_DECLARE_FLAGS(Constraints, Constraint)
149 Q_DECLARE_FLAGS(Options, Option)
162 KDbField(
const QString &name, Type type, Constraints constr = NoConstraints,
163 Options options = NoOptions,
int maxLength = 0,
int precision = 0,
179 static int typesCount();
182 static int specialTypesCount();
185 static int typeGroupsCount();
202 static QString typeName(Type type);
215 static QString typeString(Type type);
222 static Type typeForString(
const QString& typeString);
227 static TypeGroup typeGroupForString(
const QString& typeGroupString);
233 static TypeGroup typeGroup(Type type);
236 static QString typeGroupName(TypeGroup typeGroup);
244 static QString typeGroupString(TypeGroup typeGroup);
283 return constraints() & AutoInc;
288 return constraints() & PrimaryKey;
293 return constraints() & Unique;
298 return constraints() & ForeignKey;
303 return constraints() & NotNull;
308 return constraints() & NotEmpty;
313 return constraints() & Indexed;
323 static bool isNumericType(Type type);
332 static bool isIntegerType(Type type);
341 static bool isFPNumericType(Type type);
350 static bool isDateTimeType(Type type);
359 static bool isTextType(Type type);
362 Options options()
const;
365 void setOptions(Options options);
369 return variantType(type());
411 void setSubType(
const QString& subType);
419 static int defaultMaxLength();
423 static void setDefaultMaxLength(
int maxLength);
435 Q_ENUM(MaxLengthStrategy)
440 MaxLengthStrategy maxLengthStrategy()
const;
453 void setMaxLengthStrategy(MaxLengthStrategy strategy);
457 int maxLength()
const;
465 void setMaxLength(
int maxLength);
469 int precision()
const;
496 int visibleDecimalPlaces()
const;
499 Constraints constraints()
const;
516 return options() & Unsigned;
527 static bool hasEmptyProperty(Type type);
537 static bool isAutoIncrementAllowed(Type type);
542 void setType(Type t);
545 void setName(
const QString& name);
551 void setConstraints(Constraints c);
555 void setScale(
int s);
559 void setVisibleDecimalPlaces(
int p);
562 void setPrecision(
int p);
565 void setUnsigned(
bool u);
569 void setDefaultValue(
const QVariant& def);
579 void setAutoIncrement(
bool a);
590 void setPrimaryKey(
bool p);
595 void setUniqueKey(
bool u);
599 void setForeignKey(
bool f);
605 void setNotNull(
bool n);
611 void setNotEmpty(
bool n);
624 void setIndexed(
bool s);
627 void setCaption(
const QString& caption);
630 void setDescription(
const QString& description);
666 bool isExpression()
const;
710 void setOrder(
int order);
Provides database connection, allowing queries and data modification.
The KDbExpression class represents a base class for all expressions.
QList< Pair > PairList
list of fields pair
QList< KDbField * >::ConstIterator ListIterator
iterator for list of fields
bool isNumericType() const
bool isAutoIncrementAllowed() const
QVariant::Type variantType() const
Converts field's type to QVariant equivalent as accurate as possible.
bool isAutoIncrement() const
bool isQueryAsterisk() const
QVector< KDbField * > Vector
vector of fields
bool isDateTimeType() const
QHash< QByteArray, QVariant > CustomPropertiesMap
A data type used for handling custom properties of a field.
bool isForeignKey() const
bool isFPNumericType() const
QString typeGroupString() const
bool isIntegerType() const
QString typeString() const
bool isUnsigned() const
if the type has the unsigned attribute
bool hasEmptyProperty() const
QPair< KDbField *, KDbField * > Pair
fields pair
QString typeGroupName() const
KDbUtils::AutodeletedList< KDbField * > List
list of fields
bool isPrimaryKey() const
TypeGroup typeGroup() const
KDbQuerySchema provides information about database query.