I have been using Hybernate before, however this was while programming in Java.
Now im working on a project in C++. I must say i really enjoyed the features hybernate provided as debugging huge SQL sentences is pain.
The issue im having is that i would like to use the QODBC3 driver rather than the QSQLITE driver direct. I have made a test application so i can see that the config of odbc is propper, and is using a SQLite3.
I tried to compile and use the qxBlog application. It works straight out the box if i do NOT modify any code.(Just changed some path in the .pro). When i change the DB driver to QODBC3 thats when the errors start.
I get the following output
- Code: Select all
[QxOrm] qx::QxSqlDatabase : create new database connection in thread '-1216039152' with key '{ca9870f6-c40d-496f-8e87-efbeba62aa30}'
[QxOrm] sql query (22 ms) : CREATE TABLE author (author_id TEXT NOT NULL PRIMARY KEY, name TEXT, birthdate DATE, sex INTEGER)
[QxOrm] sql query (1 ms) : CREATE TABLE comment (comment_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, comment_text TEXT, date_creation TIMESTAMP, blog_id INTEGER)
[QxOrm] create extra-table (relation many-to-many) : CREATE TABLE IF NOT EXISTS category_blog (category_id INTEGER NOT NULL, blog_id INTEGER NOT NULL)
[QxOrm] sql query (2 ms) : CREATE TABLE category (category_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT, description TEXT)
[QxOrm] create extra-table (relation many-to-many) : CREATE TABLE IF NOT EXISTS category_blog (blog_id INTEGER NOT NULL, category_id INTEGER NOT NULL)
[QxOrm] sql query (1 ms) : CREATE TABLE blog (blog_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, blog_text TEXT, date_creation TIMESTAMP, author_id TEXT)
"author_id_1"
QODBCResult::exec: Unable to execute statement: "[SQLite]invalid parameter"
[QxOrm] execute sql query failed : INSERT INTO author (author_id, name, birthdate, sex) VALUES (:author_id, :name, :birthdate, :sex)
QODBC3: Unable to execute statement
[SQLite]invalid parameter
[QxOrm] sql query (0 ms) : SELECT COUNT(*) FROM author
ASSERT: "qx::dao::count<author>() == 3" in file src/main.cpp, line 53
Cheking with sqlman i can see that the tables are created, but none of the insert commands worked.
Does anyone know how this can be solved so i can keep using QODBC3 driver? (Ive tried to set it to behave as a 2.0 and 3.0 driver with no change by using DB.setConnectOptions("SQL_ATTR_ODBC_VERSION=SQL_OV_ODBC3")).
NOTE:
I have also made my own test app to check that the QODBC3 driver behaves correctly. Writing normal sql sentences everything happens as expected. No errors.
Ex: works
- Code: Select all
"INSERT INTO author (name, birthdate, sex) VALUES (yey, 21111931, 1)
Hopefully there is more people with the same issue as me.
Cheers