[odb-users] Use odb.exe on window problem
阿比
kingzilang at 126.com
Thu Mar 15 09:56:08 EDT 2018
Dear, I'm Chinese and my English is so so, hope you could understand my follow question, thank you.
I use odb.exe on window to generate *-odb files use follow command
odb -d sqlite --generate-query --generate-schema person.hxx
then I get the sql statements in person-odb.cxx. In person-odb.cxx, the create table statement like follow:
("CREATE TABLE \"person\" (\n"
" \"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n"
" \"first\" TEXT NOT NULL,\n"
" \"last\" TEXT NOT NULL,\n"
" \"age\" INTEGER NOT NULL)")
But I need create table IFNOTEXISTS. Just like "CREATE TABLE IFNOTEXISTS \"person\" ....
1. I could not found something about this settings in odb --help.
2. I could found the create statement in obd/relational/sqlite/schema.cxx like follow
struct version_table: relational::version_table, context
{
version_table (base const& x): base (x) {}
virtual void
create_table ()
{
pre_statement ();
os << "CREATE TABLE IF NOT EXISTS " << qt_ << " (" << endl
<< " " << qn_ << " TEXT NOT NULL PRIMARY KEY," << endl
<< " " << qv_ << " INTEGER NOT NULL," << endl
<< " " << qm_ << " INTEGER NOT NULL)" << endl;
post_statement ();
}
It has IF NOT EXISTS, why the generate code without?
I use odb-2.4.0-i686-windows and download from https://www.codesynthesis.com/products/odb/download.xhtml.
Thank you and wait for your reply.
More information about the odb-users
mailing list