BPS datastore class. More...
#include <bpsdatastore.h>
Signals | |
void | connected () |
Signal is emitted after successful connection. | |
void | disconnected () |
Signal is emitted after disconnection. | |
Public Member Functions | |
QVariant | actorKey () const |
Return the actor's key (c_key in the t_actors table). More... | |
QString | application () const |
BpsDatastore (QObject *aParent=nullptr) | |
Constructor for the BpsDatastore objects. More... | |
void | checkin (const QString &aTerminalName=QString(), const QString &aApplicationName=QString(), bool aSingleTerminalSession=false) |
Check in the user by creating a record in table t_actors. More... | |
void | checkout () |
Check out the user by dropping the record in table t_actors. More... | |
void | clearKeys (const QVariant &aId) |
Delete a key list from table t_keys. More... | |
void | commit () |
Commit an open transaction. More... | |
void | connect () |
Connect to database server using the current settings in the properties username, password, driver, database, host and port. More... | |
QString | connection () const |
Get the connection name. More... | |
QDateTime | currentTimestamp () |
QString | database () const |
Get database name for PostgreSQL, or TNS service name or SID for Oracle. More... | |
void | disconnect () |
Disconnect from database server if currently connected. More... | |
QString | driver () const |
Get driver name. More... | |
void | dropConnection (BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope) |
Drop connection. More... | |
void | dropKeytable (const QVariant &aTableKey) |
Drops a record from t_keytables. More... | |
QString | fromDual () const |
Returns " from dual" for oracle, and an empty string otherwise. More... | |
bool | hasDivisionAccess (const QVariant &aDivisionKey) |
Checks if the current user is authorized for the division. More... | |
bool | hasPermission (const QString &aPermission) |
Checks if the current user is authorized for the named permission. More... | |
bool | hasZoneAccess (const QVariant &aZoneKey) |
Checks if the current user is authorized for the zone. More... | |
QString | host () const |
Get host IP name or address. More... | |
bool | indexExists (const QString &aName, const QString &aSchema=QString()) |
Check if a certain index exists. More... | |
QString | indexTablespace () |
Get the tablespace name used for indexes. More... | |
bool | inTransaction () const |
bool | isAdmin () const |
Check if the current user has sufficient database privileges to act as BPS user administrator. More... | |
bool | isCheckedIn (const QString &aTerminalName=QString(), const QString &aApplicationName=QString(), bool aSingleTerminalSession=false) |
Test if similar actor already checked in. More... | |
bool | isConnected () const |
Check current connection status. More... | |
bool | isDBA () const |
Check if the current user has database administrator (Oracle) or superuser (PostgreSQL) privileges respectively. More... | |
bool | isOracle () const |
Check if current driver is for Oracle. More... | |
bool | isOwner () const |
Check if the current user is the BPS owner. More... | |
bool | isPostgres () const |
Check if current driver is for PostgreSQL. More... | |
QString | joinKeys (const QVariant &aId, const QString &aRef) |
Creates a inner join clause to join a given query to the list of keys in t_keys. More... | |
QString | joinKeytable (const QVariant &aTableKey, const QString &aRef) |
Creats a inner join clause to join a given query to the list of keys in the table. More... | |
QSqlDatabase & | link () |
Get QSqlDatabase object. More... | |
bool | loadConnection (BpsSettings::Scopes aScopes=BpsSettings::LocalScopes) |
Load connection settings. More... | |
bool | lockTable (const QString &aTable, int aTimeout) |
Start a transaction with the given table locked in exclusive mode. More... | |
QVariant | makeKeytable (const QString &aKeyList) |
Creats a record in t_keytables from the given list of values. More... | |
QVariant | nextIdent (const QString &aSeqenceName) |
Get the next sequence value. More... | |
QVariant | nextKey (const QString &aTableName) |
Get the next unused key for a table. More... | |
QString | password () const |
Get database user password. More... | |
int | port () const |
Get host IP port number. More... | |
QSqlIndex * | primaryIndex (const QString &aTableName) |
Get the primary index for a certain table. More... | |
void | purgeActors () |
Purge actors which are no longer connected. More... | |
QSqlRecord * | record (const QString &aTableName) |
Get the record info for a certain table. More... | |
void | renameConnection (const QString &aConnection, BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope) |
Rename the connection. More... | |
Bps::Access | reportAccess (const QVariant &aReportKey) |
Check access to a certain report. More... | |
QStringList | roles () |
Get a list of all roles. More... | |
void | rollback () |
Rollback an open transaction. More... | |
void | saveConnection (BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope) |
Save the connection settings. More... | |
QString | schema () const |
Get BPS datastore schema name. More... | |
bool | sequenceExists (const QString &aName, const QString &aSchema=QString()) |
Check if a certain sequence exists. More... | |
QVariant | sessionId () const |
Return the current actors session id (the database internal identifier of the current session). More... | |
void | setConnection (const QString &aConnection) |
Set the connection name. More... | |
void | setDatabase (const QString &aDatabase) |
Set database name. More... | |
void | setDriver (const QString &aDriver) |
Set database driver name. More... | |
void | setHost (const QString &aHost) |
Set DB server's host name or IP address. More... | |
QVariant | setKeys (const QList< qlonglong > &aKeys) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QVariant | setKeys (const QList< qulonglong > &aKeys) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QVariant | setKeys (const QSet< qlonglong > &aKeys) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QVariant | setKeys (const QSet< qulonglong > &aKeys) |
Insert a key list into table t_keys. More... | |
QVariant | setKeys (const QVariantList &aKeys) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | setPassword (const QString &aPassword) |
Set database user password. More... | |
void | setPort (int aPort) |
Set the servers database service IP port number. More... | |
void | setSchema (const QString &aSchema) |
Set BPS schema. More... | |
void | setUsername (const QString &aUsername) |
Set database user name. More... | |
bool | tableExists (const QString &aName, const QString &aSchema=QString()) |
Check if a certain table exists. More... | |
QStringList | tablespaces () |
Get a list of all tablespaces. More... | |
QString | tableTablespace () |
Get the tablespace name used for tables. More... | |
QString | terminal () const |
QString | timestampValue (const QDateTime &aDateTime) const |
Returns a column text representing a constant timestamp without time zone. More... | |
void | touchActor () |
Update the actors timestamp. More... | |
void | transaction () |
Start a new transaction. More... | |
BpsTypeLiteral | typeNextval (const QString &aSequence) const |
Get a BpsTypeLiteral representing the next sequence value for use with . More... | |
void | upsert (const QString &aTable, const QVariantMap &aKeyVals, const QVariantMap &aUpdVals) |
Executes a upsert (insert/update) using MERGE on Oracle or INSERT...ON CONFLICT on PostgreSQL. More... | |
int | userid () const |
Returns the user id (the numeric bps user identification). More... | |
QVariant | userKey () const |
Returns the user's key (c_key in the t_users table). More... | |
QString | username () const |
Get database user name. More... | |
QStringList | users () |
Get a list of all database user names. More... | |
bool | viewExists (const QString &aName, const QString &aSchema=QString()) |
Check if a certain view exists. More... | |
![]() | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QObject (QObject *parent) | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static QStringList | connections () |
Get all defined connections. More... | |
static QString | quote (const QString &aText) |
Quote a literal text in single quotes to include it in a sql statement. More... | |
static QString | quote (QChar aChar) |
Quote a char in single quotes to include it in a sql statement. More... | |
static QStringList | tnsnames () |
Get a list of all Oracle TNS names. More... | |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
![]() | |
objectName | |
BPS datastore class.
This is the datastore class used throughout the BPS class library. It supports connections to PostgreSQL and to Oracle. The class encapsulates a Qt database connection, adding generic methods for both database types supported by BPS.
BpsDatastore::BpsDatastore | ( | QObject * | aParent = nullptr | ) |
Constructor for the BpsDatastore objects.
aParent | Pointer to an optional parent object. |
QVariant BpsDatastore::actorKey | ( | ) | const |
QString BpsDatastore::application | ( | ) | const |
void BpsDatastore::checkin | ( | const QString & | aTerminalName = QString() , |
const QString & | aApplicationName = QString() , |
||
bool | aSingleTerminalSession = false |
||
) |
Check in the user by creating a record in table t_actors.
Checking in is required for active users, because all permanent locks will be referencing the entry in t_actors. In case the current connection was already checked in, it will be checked out before attempting to do the new check in.
aTerminalName | The terminal name for the session. Pass an empty string to use bps->terminalName(). |
aApplicationName | The name of the application. For C++ applications the file path of the executable, for standalone scripts the file path of the script. Pass an empty string to use QCoreApplication::applicationFilePath(). |
aSingleTerminalSession | When true (typically MDE applications) other existing actors with the same terminal are checked out. When false (the default) other existing actors with same user, terminal and application get checked out. |
BpsException | When not connected, no valid userid or general sql error. |
void BpsDatastore::checkout | ( | ) |
Check out the user by dropping the record in table t_actors.
BpsException | When not connected or general sql error. |
void BpsDatastore::clearKeys | ( | const QVariant & | aId | ) |
Delete a key list from table t_keys.
aId | The ID of the list. |
void BpsDatastore::commit | ( | ) |
Commit an open transaction.
BpsException | When not connected or commit fails. |
void BpsDatastore::connect | ( | ) |
Connect to database server using the current settings in the properties username, password, driver, database, host and port.
BpsException | When driver cannot be loaded or connect fails. |
QString BpsDatastore::connection | ( | ) | const |
Get the connection name.
The default connection name is empty. The connection name serves to store the database connection parameters host name, port, database and schema in a convenient way so only the connection needs to be selected to set all four parameters in one go.
|
static |
Get all defined connections.
QDateTime BpsDatastore::currentTimestamp | ( | ) |
QString BpsDatastore::database | ( | ) | const |
Get database name for PostgreSQL, or TNS service name or SID for Oracle.
void BpsDatastore::disconnect | ( | ) |
Disconnect from database server if currently connected.
QString BpsDatastore::driver | ( | ) | const |
Get driver name.
void BpsDatastore::dropConnection | ( | BpsSettings::Scopes | aScopes = BpsSettings::LocalUserScope | ) |
Drop connection.
The database properties are removed from the settings.
aScopes | Scopes at which the settings are removed. Valid scopes include BpsSettings::LocalUserSettings, BpsSettings::LocalSystemSettings and BpsSettings::LocalInstallSettings. |
void BpsDatastore::dropKeytable | ( | const QVariant & | aTableKey | ) |
Drops a record from t_keytables.
aTableKey | Key of the record. |
QString BpsDatastore::fromDual | ( | ) | const |
Returns " from dual" for oracle, and an empty string otherwise.
bool BpsDatastore::hasDivisionAccess | ( | const QVariant & | aDivisionKey | ) |
Checks if the current user is authorized for the division.
aDivisionKey | The key within table t_divisions. |
bool BpsDatastore::hasPermission | ( | const QString & | aPermission | ) |
Checks if the current user is authorized for the named permission.
aPermission | The permission name, for example settings.view |
bool BpsDatastore::hasZoneAccess | ( | const QVariant & | aZoneKey | ) |
Checks if the current user is authorized for the zone.
aZoneKey | The key within table t_zones. |
QString BpsDatastore::host | ( | ) | const |
Get host IP name or address.
Check if a certain index exists.
aName | Name of the index. |
aSchema | Schema name. Default schema is used when omitted. |
BpsException | When the query fails. |
QString BpsDatastore::indexTablespace | ( | ) |
Get the tablespace name used for indexes.
Note that this is only working for a existing BPS schema because it queries table t_users to get the information.
bool BpsDatastore::inTransaction | ( | ) | const |
bool BpsDatastore::isAdmin | ( | ) | const |
Check if the current user has sufficient database privileges to act as BPS user administrator.
bool BpsDatastore::isCheckedIn | ( | const QString & | aTerminalName = QString() , |
const QString & | aApplicationName = QString() , |
||
bool | aSingleTerminalSession = false |
||
) |
Test if similar actor already checked in.
Call this before checkin() with the same parameters to find out if a similar actor already exists.
aTerminalName | The terminal name for the session. Pass an empty string to use bps->terminalName(). |
aApplicationName | The name of the application. For C++ applications the file path of the executable, for standalone scripts the file path of the script. Pass an empty string to use QCoreApplication::applicationFilePath(). |
aSingleTerminalSession | When true (typically MDE applications) other existing actors with the same terminal are checked. When false (the default) other existing actors with same user, terminal and application are checked. |
BpsException | When not connected, no valid userid or general sql error. |
bool BpsDatastore::isConnected | ( | ) | const |
Check current connection status.
bool BpsDatastore::isDBA | ( | ) | const |
Check if the current user has database administrator (Oracle) or superuser (PostgreSQL) privileges respectively.
bool BpsDatastore::isOracle | ( | ) | const |
Check if current driver is for Oracle.
bool BpsDatastore::isOwner | ( | ) | const |
Check if the current user is the BPS owner.
The schema must not be empty and be equal to the username. Compare of username and schema are done case insensitive.
bool BpsDatastore::isPostgres | ( | ) | const |
Check if current driver is for PostgreSQL.
Creates a inner join clause to join a given query to the list of keys in t_keys.
aId | The ID of the list. |
aRef | Text to insert as referenced column or placeholder. |
Creats a inner join clause to join a given query to the list of keys in the table.
aTableKey | The key of the record in t_keytables. |
aRef | Text to insert as referenced column or placeholder. |
QSqlDatabase& BpsDatastore::link | ( | ) |
Get QSqlDatabase object.
bool BpsDatastore::loadConnection | ( | BpsSettings::Scopes | aScopes = BpsSettings::LocalScopes | ) |
Load connection settings.
When loading a connection that has been previously saved, the properties for node, schema, database, driver, host and port are searched and loaded from the locations defined in aScopes.
aScopes | Scopes at which the settings are searched. Valid scopes include BpsSettings::LocalUserSettings, BpsSettings::LocalSystemSettings and BpsSettings::LocalInstallSettings. |
bool BpsDatastore::lockTable | ( | const QString & | aTable, |
int | aTimeout | ||
) |
Start a transaction with the given table locked in exclusive mode.
Commit or rollback the transaction to release the lock.
aTable | Name of the table to lock. |
aTimeout | Time out in seconds while waiting for lock. Special values: 0 = no wait, -1 = wait endless. |
Creats a record in t_keytables from the given list of values.
The use of keytables is required when running queries against a large number of keys. The SQL clause "IN (...)" will not work then, because of the DB restrictions for query sizes. However with keytables the number of keys is only restricted by the maximum size of a CLOB.
aKeyList | A list of keyvalues in CSV format. |
Get the next sequence value.
aSeqenceName | The name of the sequence. |
Get the next unused key for a table.
aTableName | The base name of the sequence and table, where the prefix s_ and t_ is added. Example: aName = users , sequence = s_users and table = t_users . |
QString BpsDatastore::password | ( | ) | const |
Get database user password.
int BpsDatastore::port | ( | ) | const |
Get host IP port number.
The default is -1 which will assume 5432 for PostgreSQL and 1531 for Oracle (in case not using TNS).
Get the primary index for a certain table.
If no primary index exists an empty QSqlIndex is returned.
aTableName | The name of the table. |
void BpsDatastore::purgeActors | ( | ) |
Purge actors which are no longer connected.
Such records can be present in case of crashed sessions. Removing them will release all permanent locks that still may be held.
BpsException | When not connected or general sql error. |
Quote a literal text in single quotes to include it in a sql statement.
Takes care of any single quotes within the literal.
aText | Literal text to be quoted. |
Quote a char in single quotes to include it in a sql statement.
Takes care of char being a single quote itself.
aChar | Char to be quoted. |
QSqlRecord* BpsDatastore::record | ( | const QString & | aTableName | ) |
Get the record info for a certain table.
aTableName | The name of the table. |
void BpsDatastore::renameConnection | ( | const QString & | aConnection, |
BpsSettings::Scopes | aScopes = BpsSettings::LocalUserScope |
||
) |
Rename the connection.
aConnection | New name of the connection. |
aScopes | Scopes at which the settings are renamed. Valid scopes include BpsSettings::LocalUserSettings, BpsSettings::LocalSystemSettings and BpsSettings::LocalInstallSettings. |
Bps::Access BpsDatastore::reportAccess | ( | const QVariant & | aReportKey | ) |
Check access to a certain report.
The connection must be established and checked in.
aReportKey | The key within table t_reports. |
QStringList BpsDatastore::roles | ( | ) |
Get a list of all roles.
BpsException | When the query fails. |
void BpsDatastore::rollback | ( | ) |
Rollback an open transaction.
BpsException | When not connected or rollback fails. |
void BpsDatastore::saveConnection | ( | BpsSettings::Scopes | aScopes = BpsSettings::LocalUserScope | ) |
Save the connection settings.
The database properties are saved for subsequent availability by setConnection().
aScopes | Scopes at which the settings are saved. Valid scopes include BpsSettings::LocalUserSettings, BpsSettings::LocalSystemSettings and BpsSettings::LocalInstallSettings. |
QString BpsDatastore::schema | ( | ) | const |
Get BPS datastore schema name.
Check if a certain sequence exists.
aName | Name of the sequence. |
aSchema | Schema name. Default schema is used when omitted. |
BpsException | When the query fails. |
QVariant BpsDatastore::sessionId | ( | ) | const |
void BpsDatastore::setConnection | ( | const QString & | aConnection | ) |
Set the connection name.
The database connection name is used to identify a certain connection within the application.
aConnection | Name of the connection. |
void BpsDatastore::setDatabase | ( | const QString & | aDatabase | ) |
Set database name.
aDatabase | Database name for PostgreSQL, TNS name or SID for Oracle. |
void BpsDatastore::setDriver | ( | const QString & | aDriver | ) |
Set database driver name.
The database driver name as "BPSPG" for PostgreSQL, or "BPSORA" for Oracle.
aDriver | Database driver name as "BPSPG" for PostgreSQL, or "BPSORA" for Oracle. |
void BpsDatastore::setHost | ( | const QString & | aHost | ) |
Set DB server's host name or IP address.
Either the database servers host name, or it's numeric IP address.
aHost | Database server's host name or IP address. |
Insert a key list into table t_keys.
Only unique keys are inserted, duplicates are silently ignored.
The list will get automatically deleted on disconnect. However it is good practice to purge no longer used lists with method clearKeys().
Select example:
Update example:
aKeys | The list of keys to insert. |
void BpsDatastore::setPassword | ( | const QString & | aPassword | ) |
Set database user password.
Set the password before connecting to the database.
aPassword | Password of the database user. |
void BpsDatastore::setPort | ( | int | aPort | ) |
Set the servers database service IP port number.
aPort | Database service port number on server. |
void BpsDatastore::setSchema | ( | const QString & | aSchema | ) |
Set BPS schema.
aSchema | BPS schema name. |
void BpsDatastore::setUsername | ( | const QString & | aUsername | ) |
Set database user name.
Set the username before connection to the database.
aUsername | Name of the database user. |
Check if a certain table exists.
aName | Name of the table. |
aSchema | Schema name. Default schema is used when omitted. |
BpsException | When the query fails. |
QStringList BpsDatastore::tablespaces | ( | ) |
Get a list of all tablespaces.
BpsException | When the query fails. |
QString BpsDatastore::tableTablespace | ( | ) |
Get the tablespace name used for tables.
Note that this is only working for a existing BPS schema because it queries table t_users to get the information.
QString BpsDatastore::terminal | ( | ) | const |
Returns a column text representing a constant timestamp without time zone.
Oracle example: to_timestamp('2012.01.15 13:15:21.000','YYYY.MM.DD HH24:MI:SS.FF')
PostgreSQL example: '2012-01-15 13:15:21.000'::timestamp
aDateTime | The date/time to convert |
|
static |
Get a list of all Oracle TNS names.
void BpsDatastore::touchActor | ( | ) |
Update the actors timestamp.
Will usually be called by license check routines.
void BpsDatastore::transaction | ( | ) |
Start a new transaction.
The transaction will be closed either by a call to commit, or a call to rollback.
BpsException | When not connected or transaction cannot be started. |
BpsTypeLiteral BpsDatastore::typeNextval | ( | const QString & | aSequence | ) | const |
Get a BpsTypeLiteral representing the next sequence value for use with .
void BpsDatastore::upsert | ( | const QString & | aTable, |
const QVariantMap & | aKeyVals, | ||
const QVariantMap & | aUpdVals | ||
) |
Executes a upsert (insert/update) using MERGE on Oracle or INSERT...ON CONFLICT on PostgreSQL.
Takes care of possible conflict on the primary key, when more than one client does the same exactly simultaneously, by retrying the query until success or 10 times failed.
aTable | The name of the table to upsert. |
aKeyVals | The key values together forming the primary key of the table. |
aUpdVals | The update (non-key) values. |
int BpsDatastore::userid | ( | ) | const |
Returns the user id (the numeric bps user identification).
No valid userid is returned when the username is not made up by {schema}{userid}. The userid of the BPS owner is 0.
QVariant BpsDatastore::userKey | ( | ) | const |
QString BpsDatastore::username | ( | ) | const |
Get database user name.
QStringList BpsDatastore::users | ( | ) |
Get a list of all database user names.
BpsException | When the query fails. |
Check if a certain view exists.
aName | Name of the view. |
aSchema | Schema name. Default schema is used when omitted. |
BpsException | When the query fails. |