11 #include <QStringList>
725 void upsert(
const QString& aTable,
const QVariantMap& aKeyVals,
const QVariantMap& aUpdVals);
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Public include file for BpsSettings class.
BPS datastore class.
Definition: bpsdatastore.h:61
void setDriver(const QString &aDriver)
Set database driver name.
bool isOracle() const
Check if current driver is for Oracle.
Bps::Access reportAccess(const QVariant &aReportKey)
Check access to a certain report.
void commit()
Commit an open transaction.
void setDatabase(const QString &aDatabase)
Set database name.
bool tableExists(const QString &aName, const QString &aSchema=QString())
Check if a certain table exists.
static QStringList connections()
Get all defined connections.
void purgeActors()
Purge actors which are no longer connected.
void connect()
Connect to database server using the current settings in the properties username, password,...
void setSchema(const QString &aSchema)
Set BPS schema.
QVariant setKeys(const QSet< qlonglong > &aKeys)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QSqlRecord * record(const QString &aTableName)
Get the record info for a certain table.
QVariant userKey() const
Returns the user's key (c_key in the t_users table).
static QString quote(QChar aChar)
Quote a char in single quotes to include it in a sql statement.
QString indexTablespace()
Get the tablespace name used for indexes.
bool isDBA() const
Check if the current user has database administrator (Oracle) or superuser (PostgreSQL) privileges re...
void clearKeys(const QVariant &aId)
Delete a key list from table t_keys.
static QStringList tnsnames()
Get a list of all Oracle TNS names.
bool sequenceExists(const QString &aName, const QString &aSchema=QString())
Check if a certain sequence exists.
QDateTime currentTimestamp()
int userid() const
Returns the user id (the numeric bps user identification).
void dropConnection(BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope)
Drop connection.
int port() const
Get host IP port number.
QString password() const
Get database user password.
bool indexExists(const QString &aName, const QString &aSchema=QString())
Check if a certain index exists.
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.
void transaction()
Start a new transaction.
QString username() const
Get database user name.
bool loadConnection(BpsSettings::Scopes aScopes=BpsSettings::LocalScopes)
Load connection settings.
BpsTypeLiteral typeNextval(const QString &aSequence) const
Get a BpsTypeLiteral representing the next sequence value for use with .
void disconnect()
Disconnect from database server if currently connected.
void saveConnection(BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope)
Save the connection settings.
QVariant nextKey(const QString &aTableName)
Get the next unused key for a table.
bool hasPermission(const QString &aPermission)
Checks if the current user is authorized for the named permission.
QVariant setKeys(const QVariantList &aKeys)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isCheckedIn(const QString &aTerminalName=QString(), const QString &aApplicationName=QString(), bool aSingleTerminalSession=false)
Test if similar actor already checked in.
QString database() const
Get database name for PostgreSQL, or TNS service name or SID for Oracle.
QVariant actorKey() const
Return the actor's key (c_key in the t_actors table).
void setConnection(const QString &aConnection)
Set the connection name.
bool inTransaction() const
bool isPostgres() const
Check if current driver is for PostgreSQL.
void setPort(int aPort)
Set the servers database service IP port number.
void disconnected()
Signal is emitted after disconnection.
bool isAdmin() const
Check if the current user has sufficient database privileges to act as BPS user administrator.
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.
bool viewExists(const QString &aName, const QString &aSchema=QString())
Check if a certain view exists.
QVariant sessionId() const
Return the current actors session id (the database internal identifier of the current session).
QStringList tablespaces()
Get a list of all tablespaces.
QStringList users()
Get a list of all database user names.
bool isOwner() const
Check if the current user is the BPS owner.
void setPassword(const QString &aPassword)
Set database user password.
QString fromDual() const
Returns " from dual" for oracle, and an empty string otherwise.
void connected()
Signal is emitted after successful connection.
QString schema() const
Get BPS datastore schema name.
QString timestampValue(const QDateTime &aDateTime) const
Returns a column text representing a constant timestamp without time zone.
QVariant setKeys(const QList< qulonglong > &aKeys)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool lockTable(const QString &aTable, int aTimeout)
Start a transaction with the given table locked in exclusive mode.
QString host() const
Get host IP name or address.
bool hasDivisionAccess(const QVariant &aDivisionKey)
Checks if the current user is authorized for the division.
bool isConnected() const
Check current connection status.
QStringList roles()
Get a list of all roles.
void setHost(const QString &aHost)
Set DB server's host name or IP address.
QString tableTablespace()
Get the tablespace name used for tables.
QString connection() const
Get the connection name.
QSqlIndex * primaryIndex(const QString &aTableName)
Get the primary index for a certain table.
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.
static QString quote(const QString &aText)
Quote a literal text in single quotes to include it in a sql statement.
QVariant nextIdent(const QString &aSeqenceName)
Get the next sequence value.
QString application() const
BpsDatastore(QObject *aParent=nullptr)
Constructor for the BpsDatastore objects.
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.
void dropKeytable(const QVariant &aTableKey)
Drops a record from t_keytables.
QString driver() const
Get driver name.
bool hasZoneAccess(const QVariant &aZoneKey)
Checks if the current user is authorized for the zone.
QVariant setKeys(const QList< qlonglong > &aKeys)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void rollback()
Rollback an open transaction.
QVariant makeKeytable(const QString &aKeyList)
Creats a record in t_keytables from the given list of values.
QVariant setKeys(const QSet< qulonglong > &aKeys)
Insert a key list into table t_keys.
void setUsername(const QString &aUsername)
Set database user name.
void touchActor()
Update the actors timestamp.
QSqlDatabase & link()
Get QSqlDatabase object.
void checkout()
Check out the user by dropping the record in table t_actors.
void renameConnection(const QString &aConnection, BpsSettings::Scopes aScopes=BpsSettings::LocalUserScope)
Rename the connection.
Access
Simple access control.
Definition: bps.h:126
BPS query class.
Definition: bpsquery.h:23
@ LocalUserScope
Settings of the current operating system user on the local machine.
Definition: bpssettings.h:41
@ LocalScopes
All local scopes.
Definition: bpssettings.h:73
Dummy type representing a literal value for SQL operations.
Definition: bpstypes.h:70