diff options
Diffstat (limited to 'schema/custom')
-rw-r--r-- | schema/custom/database.hxx | 9 | ||||
-rw-r--r-- | schema/custom/driver.cxx | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/schema/custom/database.hxx b/schema/custom/database.hxx index 6f56224..9bb411d 100644 --- a/schema/custom/database.hxx +++ b/schema/custom/database.hxx @@ -24,6 +24,8 @@ # include <odb/pgsql/database.hxx> #elif defined(DATABASE_ORACLE) # include <odb/oracle/database.hxx> +#elif defined(DATABASE_MSSQL) +# include <odb/mssql/database.hxx> #endif inline std::auto_ptr<odb::database> @@ -45,6 +47,8 @@ create_database (int& argc, char* argv[]) odb::pgsql::database::print_usage (cerr); #elif defined(DATABASE_ORACLE) odb::oracle::database::print_usage (cerr); +#elif defined(DATABASE_MSSQL) + odb::mssql::database::print_usage (cerr); #endif exit (0); @@ -59,8 +63,9 @@ create_database (int& argc, char* argv[]) #elif defined(DATABASE_PGSQL) auto_ptr<database> db (new odb::pgsql::database (argc, argv)); #elif defined(DATABASE_ORACLE) - auto_ptr<database> db ( - new odb::oracle::database (argc, argv)); + auto_ptr<database> db (new odb::oracle::database (argc, argv)); +#elif defined(DATABASE_MSSQL) + auto_ptr<database> db (new odb::mssql::database (argc, argv)); #endif return db; diff --git a/schema/custom/driver.cxx b/schema/custom/driver.cxx index a140ee1..cc1f3ea 100644 --- a/schema/custom/driver.cxx +++ b/schema/custom/driver.cxx @@ -27,7 +27,9 @@ main (int argc, char* argv[]) // Create the database schema. // -#if defined(DATABASE_MYSQL) || defined(DATABASE_SQLITE) +#if defined(DATABASE_MYSQL) || \ + defined(DATABASE_SQLITE) || \ + defined(DATABASE_MSSQL) { // Due to bugs in SQLite foreign key support for DDL statements, @@ -46,9 +48,9 @@ main (int argc, char* argv[]) // try { - db->execute ("DROP TABLE Employer"); - db->execute ("DROP TABLE Employee"); db->execute ("DROP TABLE EmployeeDegree"); + db->execute ("DROP TABLE Employee"); + db->execute ("DROP TABLE Employer"); } catch (const odb::exception&) { @@ -60,14 +62,14 @@ main (int argc, char* argv[]) db->execute ( "CREATE TABLE Employee (" - "ssn INTEGER UNSIGNED NOT NULL PRIMARY KEY," + "ssn INTEGER NOT NULL PRIMARY KEY," "first_name VARCHAR (255) NOT NULL," "last_name VARCHAR (255) NOT NULL," "employer VARCHAR (255) NOT NULL REFERENCES Employer (name))"); db->execute ( "CREATE TABLE EmployeeDegree (" - "ssn INTEGER UNSIGNED NOT NULL REFERENCES Employee (ssn)," + "ssn INTEGER NOT NULL REFERENCES Employee (ssn)," "degree VARCHAR (255) NOT NULL)"); t.commit (); |