class hk_database
|
represents a particular database on the SQL Server. More... |
|
|
Public Types
Public Methods
- virtual ~hk_database ()
- bool set_name (const hk_string& n)
- hk_string name (void)
- vector<hk_string>* tablelist (bool with_systemtable=false)
- vector<hk_string>* viewlist ()
- vector<hk_string>* tableviewlist (bool with_systemtable=false)
- vector<hk_string>* querylist (void)
- vector<hk_string>* formlist (void)
- vector<hk_string>* reportlist (void)
- hk_datasource* new_table (const hk_string& name="",hk_presentation* p=NULL)
- hk_datasource* new_resultquery (hk_presentation* p=NULL)
- hk_actionquery* new_actionquery (void)
- hk_datasource* new_view (const hk_string& name="",hk_presentation* p=NULL)
- hk_datasource* load_datasource (const hk_string& name,datasourcetype dt=dt_table,hk_presentation* p=NULL)
- bool delete_table (const hk_string& table,enum_interaction x=interactive)
- bool delete_view (const hk_string& view, enum_interaction x=interactive)
- bool table_exists (const hk_string& tablename)
- bool view_exists (const hk_string& viewname)
- bool query_exists (const hk_string& queryname)
- hk_connection* connection (void) const
- ofstream* savestream (const hk_string&name,filetype type,bool ask_before_overwrite=true )
- ofstream* savestream (const hk_string&name,filetype type,bool ask_before_overwrite,bool with_header,bool ask_for_new_name=false )
- stringstream* savestringstream (filetype type)
- strstream* savestringstream (filetype type)
- stringstream* savestringstream (filetype type,bool with_header)
- strstream* savestringstream (filetype type,bool with_header)
- bool delete_file (const hk_string& name,filetype type,enum_interaction x=interactive)
- hk_presentation* existing_presentation (const hk_string& name, hk_presentation::enum_presentationtype t)
- hk_form* existing_form (const hk_string name)
- hk_report* existing_report (const hk_string name)
- void save (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite=true,bool ask_for_new_name=false )
- hk_string load (const hk_string& name,filetype type)
- hk_string database_path (void)
- hk_string fileendings (filetype e)
- hk_string fileendings (objecttype e)
- bool copy_table (hk_datasource* fromdatasource,bool schema_and_data,bool replacetable, bool ask,progress_dialogtype* progressdialog=NULL)
- bool copy_view (hk_datasource* fromdatasource,progress_dialogtype* progressdialog=NULL,const hk_string& newname="")
- hk_form* new_formvisible (void)
- hk_report* new_reportvisible (void)
- hk_dstable* new_tablevisible (void)
- hk_dsquery* new_queryvisible (void)
- void set_usewidgetparent (hk_class*)
- bool rename_table (const hk_string& originalname, const hk_string& newname,enum_interaction x=interactive)
- bool rename_file (const hk_string& originalname, const hk_string& newname,filetype type,enum_interaction x=interactive)
- void disable (void)
- void set_storagemode (filetype, enum_storagemode load,enum_storagemode store)
- enum_storagemode storagemode (filetype)
- enum_storagemode loadmode (filetype)
- bool create_centralstoragetable (void)
- bool has_centralstoragetable (void)
- hk_string load_local (const hk_string& name,filetype type)
- hk_string load_central (const hk_string& name,filetype type)
- void save_local (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite,bool ask_for_new_name)
- void save_central (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite,bool ask_for_new_name)
- bool delete_localfile (const hk_string& name,filetype type,enum_interaction x=interactive)
- bool delete_centralfile (const hk_string& name,filetype type,enum_interaction x=interactive)
- vector<hk_string>* filelist (filetype type)
- vector<hk_string>* local_filelist (filetype type)
- vector<hk_string>* central_filelist (filetype type)
- void save_configuration (void)
Public Static Methods
Protected Methods
Protected Members
represents a particular existing database on the SQL Server. To use
it set the name of an existing database with set_name
To create a new database use hk_connection::create_database.
~hk_database ()
| ~hk_database |
[virtual]
name of the database.
vector<hk_string>* tablelist (bool with_systemtable=false)
| tablelist |
if hk_connection is connected, the tablelist shows all existing tables
in this database after you set the name of an existing database with set_name.
The list will be created new every time you call this function.
So be careful. Never use i.e. for_each(tablelist()->begin(),tablelist()->end(),anyfunction)
Use instead:
vector* mylist=tablelist();
for_each(mylist->begin(),mylist->end(),anyfunction)
vector<hk_string>* tableviewlist (bool with_systemtable=false)
| tableviewlist |
vector<hk_string>* querylist (void)
| querylist |
Returns: a list of the names of all existing queries in this database
Returns: a list of the names of all existing form in this database
vector<hk_string>* reportlist (void)
| reportlist |
Returns: a list of the names of all existing reports in this database
if you want to work with a particular table, create a hk_datasource element with this function.
In a table, the data can be edited.
if you want to work with your own dmlquery ( a SELECT ... statement), create a hk_datasource element with
this function (dml= data manipulation language).
All Select queries are possible (i.e. GROUP BY). The resulting data canīt be edited.
If you want to work with your own ddl queries, create a hk_action element with this function.
A ddlquery (ddl= Data Definition Language) allows you to execute
all non-SELECT queries (i.e. UPDATE, INSERT queries). This type of query has no result.
loads an existing table or resultquery
Parameters:
name | name of the query or table
|
query | if true this function tries to load a query with the name "name" else a table
|
p | if this datasource is part of a form or a report this is the pointer to this
hk_presentation object
|
Returns: a datasource (either a table or a resultquery) if successful else NULL
bool delete_table (const hk_string& table,enum_interaction x=interactive)
| delete_table |
removes a table from the database and deletes all data.
bool delete_view (const hk_string& view, enum_interaction x=interactive)
| delete_view |
bool table_exists (const hk_string& tablename)
| table_exists |
checks whether a table exists
bool view_exists (const hk_string& viewname)
| view_exists |
bool query_exists (const hk_string& queryname)
| query_exists |
[const]
Returns: the parent connection
ofstream* savestream (const hk_string&name,filetype type,bool ask_before_overwrite=true )
| savestream |
creates a stream object to store a file. Usually you don't have to use this function
Parameters:
name | the name of the file
|
type | the type of the file (i.e. query or form)
|
ask_before_overwrite | if true and a file of this type and this name already exists you will
be asked whether or not to overwrite this file
|
Returns: the stream if successful else NULL
ofstream* savestream (const hk_string&name,filetype type,bool ask_before_overwrite,bool with_header,bool ask_for_new_name=false )
| savestream |
stringstream* savestringstream (filetype type)
| savestringstream |
strstream* savestringstream (filetype type)
| savestringstream |
stringstream* savestringstream (filetype type,bool with_header)
| savestringstream |
strstream* savestringstream (filetype type,bool with_header)
| savestringstream |
bool delete_file (const hk_string& name,filetype type,enum_interaction x=interactive)
| delete_file |
deletes a file physically. Usually you don't have to use this function
Parameters:
name | name of the file
|
type | type of the file (i.e. query or form)
|
Returns: true if successful else false
looks whether there is a already created hk_presentation object (form or report)
usefull if you need a handle to an already opened form
Parameters:
name | name of the presentation
|
t | type of the presentation( form or report)
|
Returns: the object if existing else NULL
void save (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite=true,bool ask_for_new_name=false )
| save |
save physically in a file. Usually you don't have to use this function
Parameters:
statement | the content to store
|
name | the name of the file
|
type | the type of the file (i.e. form or query)
|
load physically from a file. Usually you don't have to use this function
Parameters:
name | the name of the file
|
type | the type of the file (i.e. form or query)
|
Returns: the content of the file
returns the path where hk_classes stores forms, queries, and reports
usually ~/.hk_classes/dbdriver/host/dbname
hk_string fileendings (filetype e)
| fileendings |
hk_string fileendings (objecttype e)
| fileendings |
creates a new table and uses an existing datasource as a template
Parameters:
fromdatasource | the datasource which is used as a template
|
schema_and_data | if true the table will be created and the data copied, if false the data will be not copied
|
replacetable | see parameter ask for details
|
ask | ask=true and replacetable=true => you will be warned before overwriting an old table
ask=true and replacetable=false => a new name will be asked
ask=false and replacetable=true => an old table will be overwritten without warning
ask=false and replacetable=false => copy_table immediately stops and returns false, if a table already exists
|
hk_form* new_formvisible (void)
| new_formvisible |
hk_report* new_reportvisible (void)
| new_reportvisible |
hk_dstable* new_tablevisible (void)
| new_tablevisible |
hk_dsquery* new_queryvisible (void)
| new_queryvisible |
void set_new_formvisiblefunction (newform_type*)
| set_new_formvisiblefunction |
[static]
void set_new_reportvisiblefunction (newreport_type*)
| set_new_reportvisiblefunction |
[static]
void set_new_tablevisiblefunction (newtable_type*)
| set_new_tablevisiblefunction |
[static]
void set_new_queryvisiblefunction (newquery_type*)
| set_new_queryvisiblefunction |
[static]
void set_usewidgetparent (hk_class*)
| set_usewidgetparent |
bool rename_table (const hk_string& originalname, const hk_string& newname,enum_interaction x=interactive)
| rename_table |
renames the table
Parameters:
originaltable | old name of the table
|
newname | new name of the tbale,
|
x | if set to interactive warningmessages wil be displayed in case of an error
|
bool rename_file (const hk_string& originalname, const hk_string& newname,filetype type,enum_interaction x=interactive)
| rename_file |
renames files (queries, forms and reports) and also handles table renaming
Parameters:
originaltable | old name of the table
|
newname | new name of the tbale,
|
filetype | the type of file, see hk_definitions::filetype for details
|
x | if set to interactive warningmessages wil be displayed in case of an error
|
void disable (void)
| disable |
informs the datasources and visible objects that the database shuts down and sets the
database name to ""
enum enum_storagemode {central,local}
| enum_storagemode |
void set_storagemode (filetype, enum_storagemode load,enum_storagemode store)
| set_storagemode |
enum_storagemode storagemode (filetype)
| storagemode |
enum_storagemode loadmode (filetype)
| loadmode |
bool create_centralstoragetable (void)
| create_centralstoragetable |
bool has_centralstoragetable (void)
| has_centralstoragetable |
void save_local (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite,bool ask_for_new_name)
| save_local |
void save_central (const hk_string& statement,const hk_string& name,filetype type,bool ask_before_overwrite,bool ask_for_new_name)
| save_central |
bool delete_localfile (const hk_string& name,filetype type,enum_interaction x=interactive)
| delete_localfile |
bool delete_centralfile (const hk_string& name,filetype type,enum_interaction x=interactive)
| delete_centralfile |
vector<hk_string>* filelist (filetype type)
| filelist |
vector<hk_string>* local_filelist (filetype type)
| local_filelist |
vector<hk_string>* central_filelist (filetype type)
| central_filelist |
void save_configuration (void)
| save_configuration |
[protected]
bool select_db ( const hk_string& newname)
| select_db |
[protected]
void inform_datasources_before_closing (void)
| inform_datasources_before_closing |
[protected]
void driver_specific_tablelist (void)
| driver_specific_tablelist |
[protected virtual]
driver_specific_tablelist has to set the protected variable p_tablelist
void driver_specific_viewlist (void)
| driver_specific_viewlist |
[protected virtual]
[protected virtual]
[protected virtual]
[protected virtual]
hk_actionquery* driver_specific_new_actionquery (void)
| driver_specific_new_actionquery |
[protected virtual]
bool driver_specific_rename_table (const hk_string& oldname,const hk_string& newname)
| driver_specific_rename_table |
[protected virtual]
bool driver_specific_select_db (void)
| driver_specific_select_db |
[protected virtual]
void driver_specific_set_name (void)
| driver_specific_set_name |
[protected virtual]
[protected]
void ds_remove (hk_data* ds)
| ds_remove |
[protected]
void connection_connected (void)
| connection_connected |
[protected virtual]
void connection_disconnected (void)
| connection_disconnected |
[protected virtual]
[protected]
[protected]
vector<hk_string> p_tableviewlist
| p_tableviewlist |
[protected]
[protected]
[protected]
void clear_visiblelist (void)
| clear_visiblelist |
[protected]
void before_source_vanishes (void)
| before_source_vanishes |
[protected virtual]
[protected]
[protected]
void load_configuration (void)
| load_configuration |
[protected]
void savedata (ostream& s)
| savedata |
[protected virtual]
Reimplemented from hk_class.
void loaddata (const hk_string& definition)
| loaddata |
[protected virtual]
Reimplemented from hk_class.
[protected]
- Version: $Revision: 1.5 $
- Author: Horst Knorr (hk_classes@knoda.org)
- Generated: horst on horstnotebook on Mon Nov 22 10:41:06 2004, using kdoc 2.0a54.