00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019
00020 #ifndef FIELD_H
00021 #define FIELD_H
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include "kdb.h"
00028 #include "object.h"
00029
00030 #include <qlist.h>
00031 #include <qstring.h>
00032 #include <qdatetime.h>
00033
00034
00035 namespace KDB {
00036
00037 class Handler;
00038
00039 class Field;
00040 typedef QList<Field> FieldList;
00041 typedef QListIterator<Field> FieldIterator;
00042
00079
00080 class Field :public Object {
00081
00082 friend class Recordset;
00083 friend class Record;
00084 friend class Table;
00085
00086 Q_OBJECT
00087
00088 public:
00089
00090 ~Field();
00091
00092 void setPrecision(unsigned int size);
00093 unsigned int precision();
00094
00095 void setSize(unsigned int size);
00096 unsigned int size();
00097
00098 void setType(DataType t);
00099 DataType type() ;
00100
00101 QString nativeType();
00102
00103 void setConstraint(const QString &val);
00104 QString constraint() ;
00105
00106 void setAcceptNull(bool);
00107 bool acceptNull();
00108
00109 bool isNull();
00110
00111 void operator =(const QString &newVal) ;
00112 void operator =(const QDateTime &newVal) ;
00113 void operator =(int newVal) ;
00114 void operator =(double newVal) ;
00115
00116 operator QString() ;
00117 operator QDateTime() ;
00118 operator int() ;
00119 operator double() ;
00120
00121 private:
00122 Field (const QString &name, QObject *parent = 0);
00123 Field (Handler *h, const QString &name, const QByteArray &val, QObject *parent = 0);
00124
00125 QByteArray m_val;
00126 Handler *m_handler;
00127
00128 DataType m_type;
00129 unsigned int m_size;
00130 unsigned int m_precision;
00131 QString m_constraint;
00132 bool m_acceptNull;
00133 };
00134
00135 }
00136
00137 #endif
00138
00139