DbUpdate Class ReferenceDbUpdate use DbUpdateScriptsParser interface to get collection of SQL statements for database schema update.
More...
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| DbUpdate (SharedSQLArchive &pArchive, DbUpdateScriptsParser &pFileParser) | |
| Constructor. | |
| virtual std::string | getCurrentVersion () const |
| Get version string from database table "db_version", field "version". | |
| void | update (const std::string &pVersion="") |
| Update database. | |
Protected Member Functions | |
| virtual int | onSendUpdate (SQLOStream &pOStream, std::string &pQuery) |
| Send single query to database. | |
Protected Attributes | |
| DbUpdateScriptsParser & | mFileParser |
| Parser used to get queries from scripts. | |
Detailed Description
DbUpdate use DbUpdateScriptsParser interface to get collection of SQL statements for database schema update.This interface allows progress bar implementation for derived classes.
This interface requires SQL table db_version to exists in database with following schema:
CREATE TABLE db_version ( version VARCHAR(128) );
Constructor & Destructor Documentation
| DbUpdate | ( | SharedSQLArchive & | pArchive, | |
| DbUpdateScriptsParser & | pFileParser | |||
| ) |
Constructor.
- Parameters:
-
pArchive already open SQL database where update will be performed pFileParser parser capable of reading update scripts
Member Function Documentation
| virtual int onSendUpdate | ( | SQLOStream & | pOStream, | |
| std::string & | pQuery | |||
| ) | [protected, virtual] |
Send single query to database.
- Warning:
- all BEGIN (TRANSACTION) and COMMIT statements are removed
all CREATE DATABASE statements are querying outside transaction
- Parameters:
-
pOStream stream used to send query pQuery query contents
- Returns:
- number of updated records FIXME better statement recognition (mixed case) and empty query (do not send white chars only)
| void update | ( | const std::string & | pVersion = "" |
) |
Update database.
This is done by reading query list by passed DbUpdateScruptParser and calling onSendUpdate for every read query. After update new version string is set in database
- Parameters:
-
pVersion target version for update. If empty, then update will call all available scripts from sets.
The documentation for this class was generated from the following file:
| Documentation |
|---|
| Quick start |
| Examples |
| API Documentation |
|---|
| Class hierarchy |
| Member index |
| API Reference |
| Store filters |
| Store table macros |
Generated by doxygen at Fri Oct 22 23:15:44 2010

