Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

TStorage Class Reference

This is the famous storage class. It manages all MySQL and sqlite traffic. More...

#include <TStorage.h>

List of all members.

Public Member Functions

 TStorage (int nt, wxString fn=_T(""))
 Constructor.
 ~TStorage ()
 Destructor.
void createDatabase ()
 Creates the database, is it does not exist.
TSQLresult getObject (const wxString &query)
 Runs a query.
void sqlAdd (wxString &s1, wxString &s2, wxString key, wxString value)
 Query construction helper method.
void sqlAdd (wxString &s1, wxString &s2, wxString key, char *value)
 Query construction helper method.
void sqlAdd (wxString &s1, wxString &s2, wxString key, int value)
 Query construction helper method.
void import ()
 Import enzymes from database.
TRestrictionEnzymegetRestrictionEnzyme (wxString s)
 Pointer to TRestrictionEnzyme from re.
void getEnzymeGroups (wxArrayString &vs)
 List of enzyme groups in this database.
void getEnzymesInGroup (wxString gn, wxArrayString &vs)
 List of enzymes in a specific group.
void updateRestrictionEnzyme (TRestrictionEnzyme *e)
 Write enzyme information back to database.
void addRestrictionEnzyme (TRestrictionEnzyme *r)
 Add new restriction enzyme.
bool addEnzymeGroup (wxString s)
 Add new enzyme group.
void markEnzymeForDeletion (wxString s)
 Mark an enzyme for deletion.
TProteasegetProtease (wxString s)
 Pointer to a TProtease from pr.
void updateProtease (TProtease *p)
 Write protease information back to database.
wxString getDatabaseList (wxArrayString &name, wxArrayString &file)
 List of all known databases.
void setOption (wxString oname, int value)
 Set option in local database.
void setOption (wxString oname, wxString vname)
 Set option in local database.
int getOption (wxString oname, int def)
 Get option from local database.
wxString getOption (wxString oname, wxString def)
 Get option from local database.
bool copySQLfields (TStorage &target, wxString table, wxString cond)
 Internal use for update.
void synchronize ()
 Synchronize information between databases (not used).
void startup ()
 Startup method.
void autoUpdateSchema ()
 Update database to a new schema.
wxString fixDNAname (wxString s)
 Fix name quotes.
wxString UCfirst (wxString s)
 Uppercase first letter in string.
wxString getDBname ()
 Return the database name.
bool getWriteProtect ()
 Is this database write protected?
void optimizeDatabase ()
 Optimize sqlite database.
wxString getDefaultDB ()
 Returns the name of the default (standard) database.
void addEnzymeToGroup (wxString enzyme, wxString group)
 Add a restriction enzyme to an enzyme group.
void removeEnzymeFromGroup (wxString enzyme, wxString group)
 Remove an enzyme from an enzyme group.
void removeEnzymeGroup (wxString group)
 Remove an enzyme group.
void syncEnzymes (TStorage *to=NULL)
 Get new enzymes from (basic) database.
void startRecord ()
 Start recording queries.
void endRecord ()
 Stop recording, execute all recorded queries.

Static Public Member Functions

static wxString createMySQLdb (wxString ip, wxString db, wxString name, wxString pwd)
 Create a MySQL database.

Public Attributes

wxArrayTRestrictionEnzyme re
 List of restriction enzymes in this database.
wxArrayTProtease pr
 List of proteases in this database.
TSQLresult results
 The results of the last query.

Private Member Functions

wxString getSingleField (wxString query, wxString field, wxString def=_T(""))
 Get a single field from a query, with default value.
int getSingleField (wxString query, wxString field, int def=0)
 Get a single field from a query, with default value.
wxString makeInsert (wxString table, wxArrayString &field, wxArrayString &data)
 Insert all the fields with their data into a table.
void replaceTable (wxString table, wxArrayString &f, wxArrayString &t)
 ???
void tableInfoSet (wxArrayString &f, wxArrayString &t, wxString nf, wxString nt)
 ???
TStoragegetDBfromEnzymeGroup (wxString group)
 Returns the database of the enzyme group.
wxString stripGroupName (wxString s)
 ???
void cleanEnzymeGroupCache ()
 Clear the enzyme group cache.
void setEnzymeCache (wxString group, wxArrayString &enzymes)
 Set cache for an enzyme group.
void getEnzymeCache (wxString group, wxArrayString &enzymes)
 Get cached enzyme group data.
bool isLocalDB ()
 Is this the local database?
bool convertSqlite2to3 ()
 Converts a sqlite2 database into sqlite3.
void createDatabaseSqlite3 ()
 Creates an sqlite3 database (NOT FUNCTIONAL).
TSQLresult getObjectSqlite2 (const wxString &query)
 Get object from sqlite2 database.
TSQLresult getObjectSqlite3 (const wxString &query)
 Get object from sqlite3 database.
TSQLresult getObject_MySQL (const wxString &query)
 Get object from MySQL database.

Private Attributes

wxArrayString enzymeGroupCache
wxArrayString enzymeGroupNameCache
wxString dbname
wxString error
int storagetype
int ierror
bool writeProtect
 Database is write-protected, because this program version is too old.
int rpv
 Required Program Version.
wxString record
 Recorded queries.
bool recording
 Record queries?
bool isMySQL
 This is a MySQL database.
bool isSqlite3
 This is a sqlite3 database.
MYSQL * conn
MYSQL * mysql


Detailed Description

This is the famous storage class. It manages all MySQL and sqlite traffic.


Constructor & Destructor Documentation

TStorage::TStorage int  nt,
wxString  fn = _T("")
 

Constructor.

!!!! wxSafeShowMessage ( wxString::Format ( txt("t_mysql_error").c_str() , dbname.mb_str() ) , mysql_error ( conn ) ) ;

TStorage::~TStorage  ) 
 

Destructor.


Member Function Documentation

bool TStorage::addEnzymeGroup wxString  s  ) 
 

Add new enzyme group.

void TStorage::addEnzymeToGroup wxString  enzyme,
wxString  group
 

Add a restriction enzyme to an enzyme group.

void TStorage::addRestrictionEnzyme TRestrictionEnzyme r  ) 
 

Add new restriction enzyme.

void TStorage::autoUpdateSchema  ) 
 

Update database to a new schema.

void TStorage::cleanEnzymeGroupCache  )  [private]
 

Clear the enzyme group cache.

bool TStorage::convertSqlite2to3  )  [private]
 

Converts a sqlite2 database into sqlite3.

bool TStorage::copySQLfields TStorage target,
wxString  table,
wxString  cond
 

Internal use for update.

This is used for auto-updating sqlite databases, which do not support ALTER TABLE

void TStorage::createDatabase  ) 
 

Creates the database, is it does not exist.

void TStorage::createDatabaseSqlite3  )  [private]
 

Creates an sqlite3 database (NOT FUNCTIONAL).

wxString TStorage::createMySQLdb wxString  ip,
wxString  db,
wxString  name,
wxString  pwd
[static]
 

Create a MySQL database.

void TStorage::endRecord  ) 
 

Stop recording, execute all recorded queries.

wxString TStorage::fixDNAname wxString  s  ) 
 

Fix name quotes.

wxString TStorage::getDatabaseList wxArrayString &  name,
wxArrayString &  file
 

List of all known databases.

TStorage * TStorage::getDBfromEnzymeGroup wxString  group  )  [private]
 

Returns the database of the enzyme group.

wxString TStorage::getDBname  ) 
 

Return the database name.

wxString TStorage::getDefaultDB  ) 
 

Returns the name of the default (standard) database.

void TStorage::getEnzymeCache wxString  group,
wxArrayString &  enzymes
[private]
 

Get cached enzyme group data.

void TStorage::getEnzymeGroups wxArrayString &  vs  ) 
 

List of enzyme groups in this database.

void TStorage::getEnzymesInGroup wxString  gn,
wxArrayString &  vs
 

List of enzymes in a specific group.

TSQLresult TStorage::getObject const wxString &  query  ) 
 

Runs a query.

TSQLresult TStorage::getObject_MySQL const wxString &  query  )  [private]
 

Get object from MySQL database.

TSQLresult TStorage::getObjectSqlite2 const wxString &  query  )  [private]
 

Get object from sqlite2 database.

TSQLresult TStorage::getObjectSqlite3 const wxString &  query  )  [private]
 

Get object from sqlite3 database.

wxString TStorage::getOption wxString  oname,
wxString  def
 

Get option from local database.

int TStorage::getOption wxString  oname,
int  def
 

Get option from local database.

TProtease * TStorage::getProtease wxString  s  ) 
 

Pointer to a TProtease from pr.

TRestrictionEnzyme * TStorage::getRestrictionEnzyme wxString  s  ) 
 

Pointer to TRestrictionEnzyme from re.

int TStorage::getSingleField wxString  query,
wxString  field,
int  def = 0
[private]
 

Get a single field from a query, with default value.

wxString TStorage::getSingleField wxString  query,
wxString  field,
wxString  def = _T("")
[private]
 

Get a single field from a query, with default value.

bool TStorage::getWriteProtect  ) 
 

Is this database write protected?

void TStorage::import  ) 
 

Import enzymes from database.

bool TStorage::isLocalDB  )  [private]
 

Is this the local database?

wxString TStorage::makeInsert wxString  table,
wxArrayString &  field,
wxArrayString &  data
[private]
 

Insert all the fields with their data into a table.

void TStorage::markEnzymeForDeletion wxString  s  ) 
 

Mark an enzyme for deletion.

void TStorage::optimizeDatabase  ) 
 

Optimize sqlite database.

void TStorage::removeEnzymeFromGroup wxString  enzyme,
wxString  group
 

Remove an enzyme from an enzyme group.

void TStorage::removeEnzymeGroup wxString  group  ) 
 

Remove an enzyme group.

void TStorage::replaceTable wxString  table,
wxArrayString &  f,
wxArrayString &  t
[private]
 

???

void TStorage::setEnzymeCache wxString  group,
wxArrayString &  enzymes
[private]
 

Set cache for an enzyme group.

void TStorage::setOption wxString  oname,
wxString  vname
 

Set option in local database.

void TStorage::setOption wxString  oname,
int  value
 

Set option in local database.

void TStorage::sqlAdd wxString &  s1,
wxString &  s2,
wxString  key,
int  value
 

Query construction helper method.

void TStorage::sqlAdd wxString &  s1,
wxString &  s2,
wxString  key,
char *  value
 

Query construction helper method.

void TStorage::sqlAdd wxString &  s1,
wxString &  s2,
wxString  key,
wxString  value
 

Query construction helper method.

void TStorage::startRecord  ) 
 

Start recording queries.

void TStorage::startup  ) 
 

Startup method.

wxString TStorage::stripGroupName wxString  s  )  [private]
 

???

void TStorage::syncEnzymes TStorage to = NULL  ) 
 

Get new enzymes from (basic) database.

void TStorage::synchronize  ) 
 

Synchronize information between databases (not used).

void TStorage::tableInfoSet wxArrayString &  f,
wxArrayString &  t,
wxString  nf,
wxString  nt
[private]
 

???

wxString TStorage::UCfirst wxString  s  ) 
 

Uppercase first letter in string.

void TStorage::updateProtease TProtease p  ) 
 

Write protease information back to database.

void TStorage::updateRestrictionEnzyme TRestrictionEnzyme e  ) 
 

Write enzyme information back to database.


Member Data Documentation

MYSQL* TStorage::conn [private]
 

wxString TStorage::dbname [private]
 

wxArrayString TStorage::enzymeGroupCache [private]
 

wxArrayString TStorage::enzymeGroupNameCache [private]
 

wxString TStorage::error [private]
 

int TStorage::ierror [private]
 

bool TStorage::isMySQL [private]
 

This is a MySQL database.

bool TStorage::isSqlite3 [private]
 

This is a sqlite3 database.

MYSQL * TStorage::mysql [private]
 

wxArrayTProtease TStorage::pr
 

List of proteases in this database.

wxArrayTRestrictionEnzyme TStorage::re
 

List of restriction enzymes in this database.

wxString TStorage::record [private]
 

Recorded queries.

bool TStorage::recording [private]
 

Record queries?

TSQLresult TStorage::results
 

The results of the last query.

int TStorage::rpv [private]
 

Required Program Version.

int TStorage::storagetype [private]
 

bool TStorage::writeProtect [private]
 

Database is write-protected, because this program version is too old.


The documentation for this class was generated from the following files:
Generated on Fri Aug 11 16:19:49 2006 for GENtle by  doxygen 1.4.1