gSAFE
1.3.8
|
#include <datalib.h>
Public Slots | |
void | addDependTableName (QString n) |
int | errorPassSlot (QString err) |
Signals | |
void | dataChanged (void) |
void | dataModifiedSignal (void) |
void | dataUpdatedSignal (void) |
void | doWorking (void) |
void | endWorking (void) |
void | startWorking (void) |
Signals inherited from HSqlHandler | |
void | errorSignal (QString err) |
Public Member Functions | |
HTableBase (QString t) | |
HTableBase (HTableBase *t) | |
~HTableBase (void) | |
void | addField (HDataField *i) |
void | blockReInitializeBase (QString hide_marker, QString ro_marker) |
void | clearAndFreeConnections (void) |
void | clearConnections (void) |
void | clearRoles (void) |
void | clearSqlSynced (void) |
void | connectTable (HTableBase *ct, int type=INNER_JOIN, QString connconstraint="") |
void | connectTable (HTableBase *ct, QString thiskey, QString thatkey, int type=INNER_JOIN, QString connconstraint="") |
void | dataUpdated (void) |
void | deepcopy_from_htablebase (HTableBase *x) |
void | delRole (QString name) |
HDataField * | fieldByIndex (int i, bool all=false) |
HDataField * | fieldBySqlName (QString sqln, bool all=false, QString containerSqlTable="") |
int | fieldCount (bool withconnect=false) |
void | firstField (void) |
void | freeTable (void) |
QStringList | getExplainHeads (void) |
QStringList | getHeads (int what) |
QStringList | getShortTitleHeads (void) |
bool | isChanged (bool all=false) |
bool | isReallyChanged (void) |
HDataField * | nextField (void) |
HDataField * | nextFieldAll (void) |
QVariant | operator[] (int i) |
void | removeSqlCooseButtons (void) |
void | resetLogging (void) |
void | returnToDefaultAllMarked (QString mark) |
void | setAllNOSet (void) |
void | setAllYESSet (void) |
void | setColor (int r, int g, int b) |
void | setColorAllMarked (QString mark, int r, int g, int b) |
void | setEditable (void) |
void | setEditableAllMarked (QString mark) |
void | setGuiDisabledAllMarked (QString mark) |
void | setGuiEnabledAllMarked (QString mark) |
void | setHide (void) |
void | setHideAllMarked (QString mark) |
void | setLogging (void) |
void | setLoggingAllMarked (QString mark) |
void | setReadolnyAllMarked (QString mark) |
void | setReadonly (void) |
void | setShow (void) |
void | setShowAllMarked (QString mark) |
void | setTableTitle (QString s) |
QString | sqlCreateString (QString switches="") |
QString | sqlSelect (QString tail="", bool all=false, bool keypart=false) |
QString | sqlSelectAll (QString tail="") |
QString | sqlSelectWk (QString tail="", bool all=false) |
QString | sqlSelectWkAll (QString tail="") |
void | sqlSynced (HDataChangeLogger *dclog=NULL, bool forcechange=false, bool forcelog=false) |
QString | sqlTableName (void) |
HDataField * | staticFieldByTitle (QString title="") |
QString | tableTitle (void) |
void | useRole (QString name) |
QString | validate (bool all=true) |
Public Member Functions inherited from HSqlHandler | |
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) |
Public Attributes | |
QString | errstr |
bool | extrafeatures |
bool | gui_showtabletitle |
Protected Attributes | |
QString | conn_part |
QStack< HTableBase * > * | connectedTableBases |
QStringList * | depend |
int | field |
QString | imc_thatkey |
HTableBase * | imc_thattable |
QString | imc_thiskey |
HDataField_List * | run |
QString | sqlTable |
HDataField_List * | table |
QString | tabletitle |
Protected Attributes inherited from HSqlHandler | |
bool | query_error_occured |
Protected Attributes inherited from HBase | |
QString | whoami |
Additional Inherited Members | |
Static Public Member Functions inherited from HSqlHandler | |
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 inherited from HSqlHandler | |
static int | trans = 0 |
Table/List base class. This class is a base class of the SQL Table class (HTable) and the SQL List (HList) class. It except the common features of lists and tables for example the handling of data fields. If you build a meta table by hand (not from XML with HFactory) you have to use functions of this class. This class achives some base SQL functions too. Usally you have not to use this class directly but in derived class.
HTableBase::HTableBase | ( | QString | t | ) |
Constructor, it created an empty base table, without data fields and any structure.
The | SQL name of the table. This table name will be used in queryes, updates etc... |
Definition at line 2270 of file datalib.cpp.
HTableBase::~HTableBase | ( | void | ) |
Destructor
Definition at line 2335 of file datalib.cpp.
HTableBase::HTableBase | ( | HTableBase * | t | ) |
Deepcopy constructor. It clones the parameter HTableBase to itself. It copies the full data structure and state and attributes of the parameter table. But connected tables is not copied neither the connection data. Only the base table is copied! If you would like to copy the whole connected table you have to copy the tables one by one, and connect them again.
x | the source table |
Definition at line 2292 of file datalib.cpp.
|
slot |
Adds a table name to the list of dependencies. This names is used by the HRefreshAgent. The HRefreshAgent can receive notifications from anywhere with a sql table name. This notifications is automatically makes refresh all tables/lists which needed. You can add more sql table name to this table as dependencies with this function. If the refresh agent receive a table name "SOMETHING" every table and list will be refresh which name match that received table name "SOMETHING" or have any dependent table name match with the notify "SOMETHING".
For example if this table works on an sql view which named "CALCULATEDSALARY" so the sql name of this table is "CALCULATEDSALARY" you can add the "SALARY" table to this table as dependendy. So when the "SALARY" table is modified the table/list will refres the data
n | the dependent sql table |
Definition at line 2408 of file datalib.cpp.
void HTableBase::addField | ( | HDataField * | i | ) |
Adds a new data field (data column) to the table. You can use this function to define the meta sql table field by field. (OR/AND you can use the HFactory class to define the metatable from XML file.) One HDataField (descendant) is usally related to an sql column of a table.
i | the HDataField (descendant) to add. |
Definition at line 2560 of file datalib.cpp.
void HTableBase::blockReInitializeBase | ( | QString | hide_marker, |
QString | ro_marker | ||
) |
Equivalent to calling the folloving functions:
hide_marker | the text HIDE_MARKER_PARAMETER |
ro_marker | the text RO_MARKER_PARAMETER |
Definition at line 2987 of file datalib.cpp.
void HTableBase::clearAndFreeConnections | ( | void | ) |
Clears the existing table connections and delete the connected tables. It destories all connections of the table. Only have to call in the base table because it's delete the connected tables.
Definition at line 2414 of file datalib.cpp.
void HTableBase::clearConnections | ( | void | ) |
Clears the existing table connections. Have to call both in the base class and in the connected class too. Destories every table connections in all directions. (Base/Connected) It does not delete the connected tables!
Definition at line 2428 of file datalib.cpp.
void HTableBase::clearRoles | ( | void | ) |
Clears every role from everywhere in this table.
Definition at line 3026 of file datalib.cpp.
void HTableBase::clearSqlSynced | ( | void | ) |
Clears the valueInSql and sync_valueInSql attributes to the default. It calls HDataField::clearSqlSynced() function on all data fields
Definition at line 3044 of file datalib.cpp.
void HTableBase::connectTable | ( | HTableBase * | ct, |
int | type = INNER_JOIN , |
||
QString | connconstraint = "" |
||
) |
Function to make automated table connection. It connects the HConnect field to the HKey. You have to call this function in base table, and pass the connected table as parameter. IT IS RECOMMEND TO USE THIS FUNCTION INSTEAD OF THE GENERAL connectTable().
ct | pointer of the connected table. (HTableBase *) |
type | the type of connection (SQL Conn type: INNER JOIN,LEFT OUTER JOIN) Only the INNER_JOIN and the LEFT_OUTER_JOIN is implemented. |
connconstraint | is the other connection constraint except the base constraint string (If X:=connconstraint then in sql "... inner join a on a.k = b.l AND X ...") |
Definition at line 2447 of file datalib.cpp.
void HTableBase::connectTable | ( | HTableBase * | ct, |
QString | thiskey, | ||
QString | thatkey, | ||
int | type = INNER_JOIN , |
||
QString | connconstraint = "" |
||
) |
Function to make a general table connection. You have to call this function in base table, and pass the connected table as parameter.
ct | pointer of the connected table. (HTableBase *) |
thiskey | connected field of this table (Base table) That table where this function is called. (this) |
thatkey | connected field of the connected table. Table passed as parameter. (ct) |
type | is the type of connection (SQL Conn type: INNER JOIN,LEFT OUTER JOIN) Only the INNER_JOIN and the LEFT_OUTER_JOIN is implemented. |
connconstraint | is the other connection constraint except the base constraint string. (If X:=connconstraint then in sql "... inner join a on a.k = b.l AND X ...") |
Definition at line 2512 of file datalib.cpp.
|
signal |
Activated anytime when any data is changed in the memory every way and every directions. This change can came from inside or outside. (From gui or api or sql) Can be used to refresh the calculated or depended fields
|
signal |
Activated when the table is modified in the sql database. It is used to notify other program parts which use same or dependent table.
void HTableBase::dataUpdated | ( | void | ) |
Call this function to makes the gui to refresh. So if you call this function the gui will be notified to re-read the data. This achived by the "dataUpdatedSignal" QT SIGNAL. (When the gui starts it connects their slots to this signal/"dataUpdatedSignal"/ )
Definition at line 2858 of file datalib.cpp.
|
signal |
It is activated when any data is changed in the memory, and the change is come from the data handlig class not the GUI! So this function can be used to tell the GUI to refresh/reload the data from the memory
void HTableBase::deepcopy_from_htablebase | ( | HTableBase * | x | ) |
Deepcopy function. It clones the parameter HTableBase to itself. It copies the full data structure and state and attributes of the parameter table. But connected tables is not copied neither the connection data. Only the base table is copied! If you would like to copy a whole connected table you have to copy the tables one by one, and connect them again.
x | the source table |
Definition at line 2307 of file datalib.cpp.
void HTableBase::delRole | ( | QString | name | ) |
Delete the parameter passed role from every data field.
the | rolename to delete |
Definition at line 3017 of file datalib.cpp.
|
signal |
Activated when a time consuming work run. Can be used by the progressbar or work indicator.
|
signal |
Activated when a time consuming work finished. Can be used by the progressbar or work indicator.
|
slot |
For internaly use. This slot is used by the data fileds. The fields can pass their error messages to this table with this slot. The addField() function connects this slot to the errorSignal of the data field.
Definition at line 2865 of file datalib.cpp.
HDataField * HTableBase::fieldByIndex | ( | int | i, |
bool | all = false |
||
) |
Returns a data field according to the index of the field in the table. (HDataField pointer) It counts out the specific data field and returns it.
i | the number of the requested data field. |
all | If this parameter true the function will search the field in the connected tables too. otherwise it's only search in this table. |
Definition at line 2363 of file datalib.cpp.
HDataField * HTableBase::fieldBySqlName | ( | QString | sqln, |
bool | all = false , |
||
QString | containerSqlTable = "" |
||
) |
Returns a data field according to the SQL name of the field. (HDataField pointer) It search the specific sql named data field and returns it.
sqln | the sql name of the requested field. |
all | If this parameter true the function will search the field in the connected tables too. otherwise it's only search in this table. |
containerSqlTable | It is only used if the all parameter is true! In that case you search the field in the connected tabless too the containerSqlTable string act as a filter for sql table name. The fieldBySqlName(A,true,B) only returns that fields which are in B named table. Use this parameter when the connected tables contain more same named fields. |
Definition at line 2342 of file datalib.cpp.
int HTableBase::fieldCount | ( | bool | withconnect = false | ) |
Returns the number of fields in the table.
withconnect | If true the function count the connected fields too. |
Definition at line 2706 of file datalib.cpp.
void HTableBase::firstField | ( | void | ) |
Access all data field step by step: Beginning of the sequence. The position will be on the first field.
Definition at line 2822 of file datalib.cpp.
void HTableBase::freeTable | ( | void | ) |
Clears the data fields of the table. (Deletes all HDataField pointer) After you call this, you will get an empty table.
Definition at line 2553 of file datalib.cpp.
|
inline |
Returns the explain texts of the fields (Every HDataField has an explain string)
QStringList HTableBase::getHeads | ( | int | what | ) |
Returns the short/long text describe of the data fields The long text is the explain text. The short text is the title text.
what | If what=1 the function returns the explain text. If what=2 the function returns the title text. |
Definition at line 2804 of file datalib.cpp.
|
inline |
Returns the title texts of the fields (Every HDataField has an title string)
bool HTableBase::isChanged | ( | bool | all = false | ) |
Returns wheter the table have a field marked to "SET" If any field in the table has "SET" the function returns true, otherwise false.
all | If all is true it examines the connected tables too. |
Definition at line 2722 of file datalib.cpp.
bool HTableBase::isReallyChanged | ( | void | ) |
Returns true if ony of the data field's value is changed according to the sql database value. It calls HDataField::isReallyChanged()
Definition at line 3053 of file datalib.cpp.
HDataField * HTableBase::nextField | ( | void | ) |
Access all data field step by step: Step to the next field, and return the current. Without connected tables!
Definition at line 2828 of file datalib.cpp.
HDataField * HTableBase::nextFieldAll | ( | void | ) |
Access all data field step by step: Step to the next field, and return the current. With the fields of the connected tables too.
Definition at line 2843 of file datalib.cpp.
QVariant HTableBase::operator[] | ( | int | i | ) |
Returns the header text of the i numbered data field(column).
Definition at line 2645 of file datalib.cpp.
void HTableBase::removeSqlCooseButtons | ( | void | ) |
Calls removeToolButton() function on all HSqlChoose instance
Definition at line 2996 of file datalib.cpp.
void HTableBase::resetLogging | ( | void | ) |
Sets every data field logged attibute's to false. It means that non of the data fields are logged by the HDataFieldLogger
Definition at line 3064 of file datalib.cpp.
void HTableBase::returnToDefaultAllMarked | ( | QString | mark | ) |
Returns the value to the default every field which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
Definition at line 2957 of file datalib.cpp.
void HTableBase::setAllNOSet | ( | void | ) |
Sets all datafields in this table to "UNSET" The data fields hold the status of their data related to the sql database, and knows wheter they updated by gui or not. (From non sql side!) If the field got "SET" status = the record need to be store to the database otherwise the changes lost. If the field got "UNSET" status = unnecessary to store the data to the database
Definition at line 2684 of file datalib.cpp.
void HTableBase::setAllYESSet | ( | void | ) |
Sets all datafields in this table to "SET" The data fields hold the status of their data related to the sql database, and knows wheter they updated by gui or not. (From non sql side!) If the field got "SET" status = the record need to be store to the database otherwise the changes lost. If the field got "UNSET" status = unnecessary to store the data to the database
Definition at line 2695 of file datalib.cpp.
void HTableBase::setColor | ( | int | r, |
int | g, | ||
int | b | ||
) |
It sets a specified color for all data fields in this table. (The gui shows the fields according their colors)
r | Red component 0-256 |
g | Green component 0-256 |
b | Blue component 0-256 |
Definition at line 2662 of file datalib.cpp.
void HTableBase::setColorAllMarked | ( | QString | mark, |
int | r, | ||
int | g, | ||
int | b | ||
) |
Sets every field's color attribute which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
r | Red component 0-256 |
g | Green component 0-256 |
b | Blue component 0-256 |
Definition at line 2947 of file datalib.cpp.
void HTableBase::setEditable | ( | void | ) |
Sets the editable attribute on all data fields. (Every field will be editable)
Definition at line 2673 of file datalib.cpp.
void HTableBase::setEditableAllMarked | ( | QString | mark | ) |
Sets every field's "EDITABLE" flag which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
Definition at line 2926 of file datalib.cpp.
void HTableBase::setGuiDisabledAllMarked | ( | QString | mark | ) |
All field, which has the "mark" marker will be emits the disableControl() signal which means the setEnabled(false) Qt function on the gui value editor control. (Visible but not editable)
Definition at line 2977 of file datalib.cpp.
void HTableBase::setGuiEnabledAllMarked | ( | QString | mark | ) |
All field, which has the "mark" marker will be emits the enableControl() signal which means the setEnabled(true) Qt function on the gui value editor control.
Definition at line 2967 of file datalib.cpp.
void HTableBase::setHide | ( | void | ) |
Sets every data field to hide/invisible. (The gui/print/etc won't show the hidden data fields)
Definition at line 2782 of file datalib.cpp.
void HTableBase::setHideAllMarked | ( | QString | mark | ) |
Sets every field's "HIDE" flag which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
Definition at line 2915 of file datalib.cpp.
void HTableBase::setLogging | ( | void | ) |
Sets every data field logged attibute's to true. It means that every data fields are logged by the HDataFieldLogger
Definition at line 3073 of file datalib.cpp.
void HTableBase::setLoggingAllMarked | ( | QString | mark | ) |
All field, which has the "mark" marker will be the logged attribute to set
Definition at line 3082 of file datalib.cpp.
void HTableBase::setReadolnyAllMarked | ( | QString | mark | ) |
Sets every field's "READONLY" flag which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
Definition at line 2937 of file datalib.cpp.
void HTableBase::setReadonly | ( | void | ) |
Sets the readonly attribute on all data fields. (Every field will be read only)
Definition at line 2771 of file datalib.cpp.
void HTableBase::setShow | ( | void | ) |
Sets every data field to show/visible. (The gui/print/etc will show these data fields)
Definition at line 2793 of file datalib.cpp.
void HTableBase::setShowAllMarked | ( | QString | mark | ) |
Sets every field's "SHOW" flag which has a mark passed in parameters. Every data field can have zero or more marker. If the mark match with one of the marks of a field the flag will be set.
Definition at line 2905 of file datalib.cpp.
|
inline |
QString HTableBase::sqlCreateString | ( | QString | switches = "" | ) |
Generates the sql create (DDL) string of the meta table. (CREATE TABLE ...)
switches | string can contain modifiers. Currently there is not implemented any modifier. |
Definition at line 2871 of file datalib.cpp.
QString HTableBase::sqlSelect | ( | QString | tail = "" , |
bool | all = false , |
||
bool | keypart = false |
||
) |
Generates a complete full detailed sql SELECT command. It queries the full table without the key field. (Every data field but the HKey) By default the connected tables are ignored.
tail | If tail:=X the place of X in the SELECT is "SELECT .. FROM .. WHERE TRUE X" Fox example the tail can be: "AND key=1" |
all | If the all false the function will ignore the connected tables, otherwise it generate the select for the connected tables too. (With joins) |
keypart | If the keypart is true the select will limit to the current key. (After the WHERE. For example ... WHERE id='001'... ) Otherwise (keypart=false) the select is not limited to the current key. |
Definition at line 2579 of file datalib.cpp.
|
inline |
Works same as sqlSelect() but the select is not limited to the current key and the select works on connected tables too. (the keypart parameter sqlSelect will be true) /sqlSelect(tail,true,false)/
|
inline |
Works same as sqlSelect() but the select is limited to the current key. (the keypart parameter sqlSelect will be true) /sqlSelect(tail,all,true)/
|
inline |
Works same as sqlSelect() but the select is limited to the current key and works on connected tables too. (the keypart parameter sqlSelect will be true) /sqlSelect(tail,true,true)/
void HTableBase::sqlSynced | ( | HDataChangeLogger * | dclog = NULL , |
bool | forcechange = false , |
||
bool | forcelog = false |
||
) |
Do not call this function unless you exacly know what you want. It's called automatically! It class HDataField::sqlSynced() function on all data field.
Definition at line 3035 of file datalib.cpp.
QString HTableBase::sqlTableName | ( | void | ) |
Returns the sql name of the table
Definition at line 2574 of file datalib.cpp.
|
signal |
Activated when a time consuming work start. Can be used by the progressbar or work indicator.
HDataField * HTableBase::staticFieldByTitle | ( | QString | title = "" | ) |
Returns a static data field by it's title. (HStatic * but returned as HDataField *) HStatic fields are static non sql fields so you can't reach them by sql name. You can find a static field by index or with this function. (According to title) It is only search HStatic typed data fields.
title | the title of the requested static field. |
Definition at line 2391 of file datalib.cpp.
|
inline |
void HTableBase::useRole | ( | QString | name | ) |
Apply the parameter passed role on this table.
the | rolename to apply |
Definition at line 3008 of file datalib.cpp.
QString HTableBase::validate | ( | bool | all = true | ) |
Starts the validation of the data fields accoring the regex pattern. Starts the high level HDataField and the lower level (type dependent) tests.
all | If true it checks the fields of connected tables too, otherwise only the fields of the base table is validated. |
Definition at line 2741 of file datalib.cpp.
|
protected |
|
protected |
QString HTableBase::errstr |
bool HTableBase::extrafeatures |
bool HTableBase::gui_showtabletitle |
|
protected |