gSAFE
1.3.8
|
#include <datalib.h>
Signals | |
void | errorSignal (QString err) |
Public Member Functions | |
HSqlHandler (void) | |
~HSqlHandler (void) | |
QSqlQuery * | allocateQSqlQuery (void) |
void | cloneSqlSettingsFrom (HSqlHandler *other) |
void | commit (void) |
bool | errorStatus (void) |
void | rollback (void) |
bool | submit0ResultQuery (QString q, QString err, bool tdisabled=false) |
QVariant | submit1ResultQuery (QString q, QString err, bool tdisabled=false) |
HPlainDataMatrix * | submitNResultQuery (int N, QString q, QString err, bool tdisabled=false) |
void | transaction (void) |
QSqlDatabase | workDB (void) |
Public Member Functions inherited from HSqlInterface | |
HSqlInterface () | |
~HSqlInterface () | |
void | cloneSqlInterfaceSettingsFrom (HSqlInterface *other) |
HSqlSingleInterface * | myInterface (void) |
QString | sqlConcatenateToLocal (QString string) |
QString | sqlConcatenateToLocal (QStringList fields) |
Public Member Functions inherited from HBase | |
HBase (void) | |
~HBase (void) | |
QString | getWhoami (void) |
Static Public Member Functions | |
static void | setCustomSqlDatabase (QString databaseName, QString sqlinterfacename="") |
static void | setDefaultSqlDatabase (void) |
Static Public Member Functions inherited from HSqlInterface | |
static HSqlSingleInterface * | currentDefaultSqlInterface (void) |
static HSqlSingleInterface * | getSqlInterface (QString interfacename) |
static void | setSqlMode (QString modename) |
static void | setSqlModeBackToFirst (void) |
Static Public Attributes | |
static int | trans = 0 |
Protected Attributes | |
bool | query_error_occured |
Protected Attributes inherited from HBase | |
QString | whoami |
The base SQL data handler class. All class working with sql is inherited from this. Here are the base sql functions, to make the base operations, error handling, make transactions etc... This class can be used directly for making atomic sql operations too.
The higher level sql manipulator classes are inherited from here.
HSqlHandler::HSqlHandler | ( | void | ) |
Creates an HSqlHandler
Definition at line 1139 of file datalib.cpp.
HSqlHandler::~HSqlHandler | ( | void | ) |
Destructor
Definition at line 1148 of file datalib.cpp.
QSqlQuery * HSqlHandler::allocateQSqlQuery | ( | void | ) |
Allocate the new QSqlQuery in the workDB() database. You have to delete after using!
Definition at line 1180 of file datalib.cpp.
void HSqlHandler::cloneSqlSettingsFrom | ( | HSqlHandler * | other | ) |
Copy the SQL settings from the given parameter HSqlHandler. (It calls cloneSqlInterfaceSettingsFrom() function too.) Copies the custom database data and interface informations.
Definition at line 1156 of file datalib.cpp.
void HSqlHandler::commit | ( | void | ) |
Commits the current transaction
Definition at line 1195 of file datalib.cpp.
|
signal |
If any error occured during the sql execution this signal is emitted. The "err" will be contains the error describe.
|
inline |
void HSqlHandler::rollback | ( | void | ) |
Rollback the current transaction
Definition at line 1210 of file datalib.cpp.
|
static |
If the program has multiple database connections, you can specify the current global database for the new HSqlHandler instances.
Those (created) HSqlHandler instances keeps the database settings permanently after creation. It means this function is SET A DEFAULT database. So the objects (Even HTables,HList,etc) stays in that database which was the current during the creation.
databaseName | the database name is that name which is used when you create the connection Example: QSqlDatabase db = QSqlDatabase::addDatabase("QODBC","this_is_the_name"); |
sqlinterfacename | you can set different sql interface for this new database. Works same way than Sql databases. If you give empty string it means no change. |
Definition at line 1124 of file datalib.cpp.
|
static |
Sets the current default database connection to active on this object. It restores the sqlinterface too.
Definition at line 1132 of file datalib.cpp.
bool HSqlHandler::submit0ResultQuery | ( | QString | q, |
QString | err, | ||
bool | tdisabled = false |
||
) |
Submit a simple SQL command which have no result (DDL/DML command)
q | The text of the SQL command |
err | In case of error the emitted error signal will be contains this message |
tdisabled | FALSE:It is submitted in a new separate transaction, TRUE:Don's start a new transaction |
Definition at line 1225 of file datalib.cpp.
QVariant HSqlHandler::submit1ResultQuery | ( | QString | q, |
QString | err, | ||
bool | tdisabled = false |
||
) |
Submit a simple SQL command which returns one result (One row,one cell) For example: SELECT count(*) FROM mytable;
q | The text of the SQL command |
err | In case of error the emitted error signal will be contains this message |
tdisabled | FALSE:It is submitted in a new separate transaction, TRUE:Don's start a new transaction |
Definition at line 1260 of file datalib.cpp.
HPlainDataMatrix * HSqlHandler::submitNResultQuery | ( | int | N, |
QString | q, | ||
QString | err, | ||
bool | tdisabled = false |
||
) |
Submits an SQL command which have a table result (Table with N row)
N | the column count of the result table. (Needed for allocate the HPlainDataMatrix) |
q | The text of the SQL command |
err | In case of error the emitted error signal will be contains this message |
tdisabled | FALSE:It is submitted in a new separate transaction, TRUE:Don's start a new transaction |
Definition at line 1302 of file datalib.cpp.
void HSqlHandler::transaction | ( | void | ) |
Begins an SQL transaction. Have to call this before calling a commit() or a rollback()
Definition at line 1185 of file datalib.cpp.
QSqlDatabase HSqlHandler::workDB | ( | void | ) |
Returns the QSqlDatabase object which sould be use. This function is used by the descendants. It controls that they use the correct database (In case of the program has multiple database connections
Definition at line 1164 of file datalib.cpp.
|
static |