iopc::ScriptsGenerator Class Reference
[iopclib]

Generates SQL CREATE and DROP scripts that create or delete database schema required for O/R mapping. More...

#include <scriptsGenerator.h>

List of all members.

Static Public Member Functions

static std::vector< std::string > getDbCreateScript (const Driver &driver)
 Generates SQL CREATE script that creates required database schema.
static std::vector< std::string > getDbDropScript (const Driver &driver)
 Generates SQL DROP script that drops the schema generated by getDbCreateScript().


Detailed Description

Generates SQL CREATE and DROP scripts that create or delete database schema required for O/R mapping.

The generator first creates a list of topologically ordered persistent classes according to their inheritance dependencies and then calls the MappingStatementsFeature for each of them in order to generate the scripts.

Following example shows how to prepare required database schema

 vector<string> script;
 script = ScriptsGenerator::getDbCreateScript(conn->getDriver());
 for(vector<string>::const_iterator it = script.begin(); it != script.end(); it++) {
        conn->sqlNonQuery(*it);
 }

Member Function Documentation

vector< string > iopc::ScriptsGenerator::getDbDropScript ( const Driver driver  )  [static]

Generates SQL DROP script that drops the schema generated by getDbCreateScript().

Note that if the class model has been changed between create nad drop script generation, the drop script may not be reliable and should be revised.


The documentation for this class was generated from the following files:

Generated on Tue Apr 14 16:46:52 2009 for IOPC 2 by  doxygen 1.5.6