#include <scriptsGenerator.h>
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(). |
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); }
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.