DbUpdate Class Reference
[Public API]

DbUpdate use DbUpdateScriptsParser interface to get collection of SQL statements for database schema update. More...

#include <dbupdate.h>

Collaboration diagram for DbUpdate:

Collaboration graph
[legend]
List of all members.

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

DbUpdateScriptsParsermFileParser
 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

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
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:20 2008