Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLManager.h 00003 ------------------- 00004 begin : Sun Jul 15 2001 00005 copyright : (C) 2001-2005 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef FLMANAGER_H 00020 #define FLMANAGER_H 00021 00022 #include "FLTableMetaData.h" 00023 00024 class QDomElement; 00025 class FLFieldMetaData; 00026 class FLRelationMetaData; 00027 class FLCompoundKey; 00028 class FLSqlQuery; 00029 class FLParameterQuery; 00030 class FLGroupByQuery; 00031 class FLAction; 00032 class FLSqlDatabase; 00033 00044 class FL_EXPORT FLManager 00045 { 00046 00047 friend class FLSqlDatabase; 00048 00049 protected: 00050 00054 FLManager(FLSqlDatabase *db); 00055 00056 public: 00057 00061 explicit FLManager(); 00062 00066 ~FLManager(); 00067 00071 void init(); 00072 00076 void finish(); 00077 00097 FLTableMetaData *metadata(const QString &n, bool quick = false); 00098 00110 FLSqlQuery *query(const QString &n, QObject *parent = 0); 00111 00122 FLAction *action(const QString &n); 00123 00132 bool existsTable(const QString &n, bool cache = true) const; 00133 00149 bool checkMetaData(const QString &n); 00150 00161 bool checkMetaData(const QString &mtd1, const QString &mtd2) { 00162 return (!QString::compare(mtd1, mtd2)); 00163 } 00164 00168 bool checkMetaData(FLTableMetaData *tmd1, FLTableMetaData *tmd2); 00169 00181 bool alterTable(const QString &n); 00182 00195 bool alterTable(const QString &mtd1, const QString &mtd2, const QString &key = QString::null); 00196 00204 FLTableMetaData *createTable(const QString &n); 00205 00213 FLTableMetaData *createTable(FLTableMetaData *tmd); 00214 00228 QString formatValueLike(FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00229 QString formatAssignValueLike(FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00230 QString formatAssignValueLike(const QString &fieldName, FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00231 QString formatAssignValueLike(const QString &fieldName, int t, const QVariant &v, const bool upper = false); 00232 00240 QString formatValueLike(int t, const QVariant &v, const bool upper = false); 00241 00255 QString formatValue(FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00256 QString formatAssignValue(FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00257 QString formatAssignValue(const QString &fieldName, FLFieldMetaData *fMD, const QVariant &v, const bool upper = false); 00258 QString formatAssignValue(const QString &fieldName, int t, const QVariant &v, const bool upper = false); 00259 00267 QString formatValue(int t, const QVariant &v, const bool upper = false); 00268 00280 FLTableMetaData *metadata(QDomElement *mtd, bool quick = false); 00281 00297 FLFieldMetaData *metadataField(QDomElement *field, bool v = true, bool ed = true); 00298 00310 FLRelationMetaData *metadataRelation(QDomElement *relation); 00311 00323 FLParameterQuery *queryParameter(QDomElement *parameter); 00324 00335 FLGroupByQuery *queryGroup(QDomElement *group); 00336 00348 FLTableMetaData *createSystemTable(const QString &n); 00349 00353 void loadTables(); 00354 00359 void cleanupMetaData(); 00360 00367 bool isSystemTable(const QString &n); 00368 00385 QString storeLargeValue(FLTableMetaData *mtd, const QString &largeValue); 00386 00393 QVariant fetchLargeValue(const QString &refKey) const; 00394 00395 private: 00396 00397 #ifndef FL_QUICK_CLIENT 00398 00401 QStringList *listTables_; 00402 00406 QDict<QString> *dictKeyMetaData_; 00407 #endif 00408 00412 QDict<FLTableMetaData> *cacheMetaData_; 00413 00417 QDict<FLAction> *cacheAction_; 00418 00422 QDict<FLTableMetaData> *cacheMetaDataSys_; 00423 00427 QDict<QVariant> *cacheLargeValues_; 00428 00432 FLSqlDatabase *db_; 00433 }; 00434 00435 #endif