Oh, great, thanks for the pointer, will do, good to known.
On Mar 16, 2021, at 5:48 PM, Elvis Stansvik <elvst...@gmail.com<mailto:elvst...@gmail.com>> wrote: Yea, you can always use db.driver()->escapeIdentifier(x, QSqlDriver::TableName) if you want to sleep a little better anyway. Elvis Den tis 16 mars 2021 kl 21:52 skrev Jérôme Godbout <godbo...@amotus.ca<mailto:godbo...@amotus.ca>>: Thanks, that was the problems, this is annoying, but I do create the query prepare with a String with arg (I known this is bad, but the tablename is provided by inner code only, this is not user inputs of any sort). On Mar 16, 2021, at 4:23 PM, Elvis Stansvik <elvst...@gmail.com<mailto:elvst...@gmail.com>> wrote: Den tis 16 mars 2021 kl 21:21 skrev Elvis Stansvik <elvst...@gmail.com<mailto:elvst...@gmail.com>>: Den tis 16 mars 2021 kl 20:19 skrev Jérôme Godbout <godbo...@amotus.ca<mailto:godbo...@amotus.ca>>: Hi, I’m trying to use the Sql with Sqlite with Qt. The database seem to be working just fine, but I run into troubles with the bind value. The named bind doesn’t seem to work (Qt 5.15.2, Mac OS): m_sql->m_create_table(m_database); m_sql->m_create_table.prepare(R"raw(CREATE TABLE IF NOT EXISTS :table name (idkey TEXT PRIMARY KEY, data TEXT) WITHOUT ROWID)raw”); You can't use a bound parameter value for the table name. This would be the case even if you used the SQLite C library. I imagine this is the case in other database engines as well. Some good answers here: https://stackoverflow.com/questions/11312737/can-i-parameterize-the-table-name-in-a-prepared-statement Elvis Elvis Note: I did try to add the ending ; it make no difference. Is it required? I do not see it in any example. The prepare return false for some reason, I did try with quotes this solve the prepare but I thing the escaping should be done automatically?! Is the value escape character automatically for named and positional args? What is wrong with this query, the query work just fine into sqlite3. CREATE TABLE IF NOT EXISTS ':tablename’ (idkey TEXT PRIMARY KEY, data TEXT) WITHOUT ROWID; It doesn’t complain, but create a table name :table name instead! The replace doesn’t occur into the quote ‘ ' This query work just fine into sqlite command line. CREATE TABLE IF NOT EXISTS toto (idkey TEXT PRIMARY KEY, data TEXT) WITHOUT ROWID; What is wrong with this?! This seem to be just like the examples, is SQLite any special in that regards (I known only a single statement is required for sqlite). Thanks, _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest Jerome Godbout Software/Firmare Lead Amotus C: (581) 777-0050 O: (418) 800-1073 ext.: 114 godbo...@amotus.ca dimonoff.com | amotus.ca We have moved! 1015 Avenue Wilfrid-Pelletier, Québec, QC G1W 0C4, 4e étage Jerome Godbout Software/Firmare Lead Amotus C: (581) 777-0050 O: (418) 800-1073 ext.: 114 godbo...@amotus.ca<mailto:godbo...@amotus.ca> [cid:image007.png@01D70B66.39FB01C0] dimonoff.com<http://dimonoff.com> | amotus.ca<http://amotus.ca> We have moved! 1015 Avenue Wilfrid-Pelletier, Québec, QC G1W 0C4, 4e étage
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest