75 typedef TQPtrList<Field>
List;
78 typedef TQPair<Field*,Field*>
Pair;
112 static uint defaultTextLength() {
return 200; }
157 Field(
const TQString& name, Type ctype,
158 uint cconst=NoConstraints,
159 uint options = NoOptions,
160 uint length=0, uint precision=0,
161 TQVariant defaultValue=TQVariant(),
162 const TQString& caption = TQString(),
163 const TQString& description = TQString(),
172 static TQVariant::Type variantType(uint type);
176 static TQString typeName(uint type);
181 static TQString typeString(uint type);
184 static Type typeForString(
const TQString& typeString);
187 static TypeGroup typeGroupForString(
const TQString& typeGroupString);
190 static TypeGroup typeGroup(uint type);
194 static TQString typeGroupName(uint typeGroup);
199 static TQString typeGroupString(uint typeGroup);
202 inline TQString name()
const {
return m_name; }
207 virtual TableSchema* table()
const;
214 virtual void setTable(TableSchema *table);
220 QuerySchema* query()
const;
228 void setQuery(QuerySchema *query);
234 inline bool isPrimaryKey()
const {
return constraints() & PrimaryKey; }
237 inline bool isUniqueKey()
const {
return constraints() & Unique; }
240 inline bool isForeignKey()
const {
return constraints() & ForeignKey; }
243 inline bool isNotNull()
const {
return constraints() & NotNull; }
246 inline bool isNotEmpty()
const {
return constraints() & NotEmpty; }
249 inline bool isIndexed()
const {
return constraints() & Indexed; }
256 static bool isNumericType(uint type);
263 static bool isIntegerType(uint type);
270 static bool isFPNumericType(uint type);
277 static bool isDateTimeType(uint type);
280 inline bool isTextType()
const {
return Field::isTextType(type()); }
284 static bool isTextType(uint type);
286 uint options()
const {
return m_options; }
288 void setOptions(uint options) { m_options = options; }
298 inline TQString
typeName()
const {
return Field::typeName(type()); }
304 inline TQString
typeGroupName()
const {
return Field::typeGroupName(type()); }
308 inline TQString
typeString()
const {
return Field::typeString(type()); }
318 inline TQString
subType()
const {
return m_subType; }
322 inline void setSubType(
const TQString& subType) { m_subType = subType; }
330 inline uint
length()
const {
return m_length; }
343 inline uint
scale()
const {
return m_length; }
368 inline int order()
const {
return m_order; }
371 inline TQString
caption()
const {
return m_caption; }
374 inline TQString
captionOrName()
const {
return m_caption.isEmpty() ? m_name : m_caption; }
381 inline uint
width()
const {
return m_width; }
384 inline bool isUnsigned()
const {
return m_options & Unsigned; }
392 static bool hasEmptyProperty(uint type);
400 static bool isAutoIncrementAllowed(uint type);
404 void setType(Type t);
407 void setName(
const TQString& name);
413 void setConstraints(uint c);
417 void setLength(uint l);
421 void setScale(uint s);
425 void setVisibleDecimalPlaces(
int p);
428 void setPrecision(uint p);
431 void setUnsigned(
bool u);
435 void setDefaultValue(
const TQVariant& def);
441 bool setDefaultValue(
const TQCString& def);
445 void setAutoIncrement(
bool a);
456 void setPrimaryKey(
bool p);
461 void setUniqueKey(
bool u);
465 void setForeignKey(
bool f);
471 void setNotNull(
bool n);
477 void setNotEmpty(
bool n);
490 void setIndexed(
bool s);
493 void setCaption(
const TQString& caption) { m_caption=caption; }
513 virtual TQString debugString()
const;
541 TQValueVector<TQString>
enumHints()
const {
return m_hints; }
542 TQString enumHint(uint num) {
return (num < m_hints.size()) ? m_hints.at(num) : TQString(); }
549 TQVariant customProperty(
const TQCString& propertyName,
550 const TQVariant& defaultValue = TQVariant())
const;
553 void setCustomProperty(
const TQCString& propertyName,
const TQVariant& value);
574 virtual Field* copy()
const;
585 TQVariant m_defaultValue;
590 TQValueVector<TQString> m_hints;
596 class KEXI_DB_EXPORT FieldTypeNames :
public TQValueVector<TQString> {
600 TQMap<TQString,Type> str2num;
602 bool m_initialized : 1;
606 class KEXI_DB_EXPORT FieldTypeGroupNames :
public TQValueVector<TQString> {
608 FieldTypeGroupNames();
610 TQMap<TQString,TypeGroup> str2num;
612 bool m_initialized : 1;