Ananas Library  0.9.5
asqltable.h
1 /****************************************************************************
2 ** $Id: asqltable.h,v 1.49 2007/09/04 13:30:23 app Exp $
3 **
4 ** Header file of the Ananas database table of Ananas
5 ** Designer and Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 **
11 ** This file is part of the Library of the Ananas
12 ** automation accounting system.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24 **
25 ** Contact org@leaderit.ru if any conditions of this licensing are
26 ** not clear to you.
27 **
28 **********************************************************************/
29 
30 #ifndef ASQLTABLE_H
31 #define ASQLTABLE_H
32 #include <qsqlcursor.h>
33 #include <qdict.h>
34 #include "acfg.h"
35 //#include "aaregister.h"
36 //#include "adatarecord.h"
37 
38 // temporray define for old definitions
39 #define aSQLTable aDataTable
40 
41 
42 class aDatabase;
43 class aSQLField;
44 
54 class ANANAS_EXPORT aDataTable : public QSqlCursor
55 {
56 public:
57  aDatabase* db;
58  QString tableName;
59  bool selected;
60 
61  aSQLTable( aCfgItem context, aDatabase *adb );
62  aSQLTable( const QString &tname, aDatabase *adb );
63  virtual ~aSQLTable();
64  void init( aCfgItem context, aDatabase *adb );
65  void setObject(aCfgItem context);
66  void appendField( aSQLField * fieldinfo );
67  void insertField( int pos, aSQLField * fieldinfo );
68  void removeField( int pos );
69  void clearFields();
70  bool checkStructure( bool update );
71  long getMdObjId();
72  Q_ULLONG getIdd();
73  void printRecord();
74  //QDict<QVariant> getUserFilter();
75  //void setUserFilter( QDict<QVariant> );
76 
77  virtual QVariant value ( int i );
78  virtual QVariant value ( const QString & name );
79  virtual void setValue ( int i, QVariant value );
80  virtual bool setValue ( const QString & name, QVariant value );
81  virtual QVariant sysValue ( const QString & name );
82  virtual void setSysValue ( const QString & name, QVariant value );
83  virtual bool sysFieldExists( const QString & name );
84 
85  virtual QSqlRecord* primeInsert();
86 // virtual QSqlRecord* primeUpdate();
87 
88  virtual bool select( const QString & filter="", bool usefltr = true );
89  virtual bool select( Q_ULLONG id );
90  virtual void clearFilter();
91  virtual bool setFilter( const QString &name, const QVariant &value );
92  virtual void setFilter( const QString& );
93  virtual QString getFilter();
94  virtual QString getNFilter();
95  virtual bool exec( QString query );
96  virtual QStringList getUserFields();
97  virtual ERR_Code setMarkDeleted( bool Deleted );
98  virtual bool isMarkDeleted();
99  QString sqlFieldName ( const QString & userFieldName ) const;
100 
101  virtual bool New();
102  virtual bool Copy();
103  virtual bool Delete();
104  virtual bool Update();
105 
106  virtual bool seek ( int i, bool relative = FALSE );
107  virtual bool next ();
108  virtual bool prev ();
109  virtual bool first ();
110  virtual bool last ();
111 
112 
113 protected:
114  QVariant calcFieldValue( const QString &name );
115  virtual QVariant calculateField( const QString &name );
116  virtual QVariant calc_obj(int fid,Q_ULLONG idd);
117  virtual QVariant calc_rem(int fid,Q_ULLONG id);
118  void insertFieldInfo(aCfgItem cobj, bool calculated=true);
119 
120  long mdobjId;
121 
122 private:
123 // bool fNewNotUpdated;
124  aCfgItem obj;
125  aCfgItem init_obj;
126  aCfg* md;
127  QDict<QObject> p_cat;
128  QDict<QObject> p_doc;
129  QDict<QObject> p_reg;
130  QMap<int,aCfgItem> mapCat, mapReg, mapDoc;
131  QMap<int,QString> mapDim,mapSum;
132  QStringList fildsList;
133  QDict<QString> fnames;
134  QDict<QVariant> userFilter;
135 // QDict<aDataField> dataRecord;
136 // aDataRecord dataRecord;
137 // QSqlRecord r;
138 };
139 
140 #endif
Класс реализует програмный интерфейс доступа к элемен...
Definition: acfg.h:436
Определяет программный интерфейс модели данных aDataTable...
Definition: asqltable.h:54
Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует QObject...
Definition: adatabase.h:77
Definition: asqlfield.h:64