Go to the documentation of this file.00001
00004 #ifndef BPSDATASTORE_H
00005 #define BPSDATASTORE_H
00006
00007 #include "bpssettings.h"
00008 #include <QObject>
00009 #include <QStringList>
00010
00011 class QSqlDatabase;
00012 class QSqlRecord;
00013 class QSqlIndex;
00014 class BpsQuery;
00015
00027 class BPSCORE_EXPORT BpsDatastore : public QObject
00028 {
00029 Q_OBJECT
00030 BPS_PRIVATE(BpsDatastore)
00031
00032 public:
00033
00038 BpsDatastore(QObject* aParent = 0);
00039
00040 virtual ~BpsDatastore();
00041
00049 QString connection() const;
00050
00057 void setConnection(const QString& aConnection);
00058
00063 QString driver() const;
00064
00070 void setDriver(const QString& aDriver);
00071
00079 QString host() const;
00080
00087 void setHost(const QString& aHost);
00088
00094 int port() const;
00095
00101 void setPort(int aPort);
00102
00110 QString database() const;
00111
00117 void setDatabase(const QString& aDatabase);
00118
00123 QString schema() const;
00124
00129 void setSchema(const QString& aSchema);
00130
00135 QString username() const;
00136
00142 void setUsername(const QString& aUsername);
00143
00148 QString password() const;
00149
00153 QString terminal() const;
00154
00158 QString application() const;
00159
00165 void setPassword(const QString& aPassword);
00166
00172 void connect();
00173
00178 void disconnect();
00179
00185 void transaction();
00186
00190 bool inTransaction() const;
00191
00199 bool lockTable(const QString& aTable, int aTimeout);
00200
00205 void commit();
00206
00211 void rollback();
00212
00218 QVariant nextIdent(const QString& aSeqenceName);
00219
00226 QVariant nextKey(const QString& aName);
00227
00234 void purgeActors();
00235
00240 void touchActor();
00241
00251 void checkin(const QString& aTerminalName = QString(), const QString& aApplicationName = QString());
00252
00257 void checkout();
00258
00264 QSqlDatabase& link();
00265
00270 bool isConnected() const;
00271
00276 bool isOracle() const;
00277
00282 bool isPostgres() const;
00283
00290 bool isOwner() const;
00291
00299 bool sequenceExists(const QString& aName, const QString& aSchema = QString());
00300
00308 bool tableExists(const QString& aName, const QString& aSchema = QString());
00309
00317 bool indexExists(const QString& aName, const QString& aSchema = QString());
00318
00326 bool viewExists(const QString& aName, const QString& aSchema = QString());
00327
00333 QSqlRecord* record(const QString& aTableName);
00334
00340 QSqlIndex* primaryIndex(const QString& aTableName);
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00359 int userid() const;
00360
00366 QVariant userKey() const;
00367
00373 QVariant actorKey() const;
00374
00380 QVariant sessionId() const;
00381
00387 QStringList users();
00388
00394 QStringList roles();
00395
00401 QStringList tablespaces();
00402
00413 bool loadConnection(BpsSettings::Scopes aScopes = BpsSettings::LocalScopes);
00414
00423 void saveConnection(BpsSettings::Scopes aScopes = BpsSettings::LocalUserScope);
00424
00433 void dropConnection(BpsSettings::Scopes aScopes = BpsSettings::LocalUserScope);
00434
00442 void renameConnection(const QString& aConnection, BpsSettings::Scopes aScopes = BpsSettings::LocalUserScope);
00443
00450 bool hasPermission(const QString& aPermission);
00451
00458 bool hasDivisionAccess(const QVariant& aDivisionKey);
00459
00466 bool hasZoneAccess(const QVariant& aZoneKey);
00467
00474 Bps::Access reportAccess(const QVariant& aReportKey);
00475
00479 QDateTime currentTimestamp();
00480
00514 QVariant setKeys(const QList<qulonglong>& aKeys);
00515
00523 QVariant setKeys(const QList<qlonglong>& aKeys);
00524
00532 QVariant setKeys(const QVariantList& aKeys);
00533
00538 void clearKeys(QVariant aId);
00539
00545 static QStringList connections();
00546
00555 static QStringList tnsnames();
00556
00563 static QString quote(const QString& aText);
00564
00571 static QString quote(QChar aChar);
00572
00573 signals:
00574
00578 void connected();
00579
00583 void disconnected();
00584
00585 };
00586
00587 #endif // BPSDATASTORE_H