Re: [Interest] QtSql database insertion issues...
Karl, don't worry. the SQL module is not going anywhere. Jason is right in the sense that it's considered done. He's wrong in thinking this has anything to do with NoSQL. NoSQL isn't emerging as a the SQL killer that NoSQL guys believe it is. Instead it's a different tool that has other use patterns. On 04/23/2015 04:45 PM, Karl Ruetz wrote: I sincerely hope you are wrong; at least for the next several years. (Like 10 years.) Staying on the bleeding edge is simply not an option for many of us that are simply Qt users (not developers). It took us years to update to Qt 5 because they killed QFTP without a fully functional replacement. QNAM does not have all the functionality for FTP that QFTP did and building QFTP with the newest versions of Qt is problematic at best. Killing the SQL module would probably mean the end of Qt for our organization. I realize that cutting edge stuff is more fun. But we live in a world where our customers keep old equipment around for decades and they are willing to pay to keep it running. So we still have to support Windows NT 4 and RHEL 4 even though it’s not as fun as working with the latest and greatest. So please, I beg of you, do not remove any functionality without a complete, viable, fully functional replacement. Karl On Apr 23, 2015, at 9:35 AM, Jason H jh...@gmx.com mailto:jh...@gmx.com wrote: Very true. If you need something like that to be agnostic, then you need to use a query builder or ORM. But it's not like Qt is very agnostic. Pragmatically speaking, the lack of constistent binding across of drivers kills it right out of the gate. In days like this, where NoSQL is an emerging trend I can't see anything really happening at the SQL module anymore. Bo Thorsen, Director, Viking Software. -- Viking Software Qt and C++ developers for hire http://www.vikingsoft.eu ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
I sincerely hope you are wrong; at least for the next several years. (Like 10 years.) Staying on the bleeding edge is simply not an option for many of us that are simply Qt users (not developers). It took us years to update to Qt 5 because they killed QFTP without a fully functional replacement. QNAM does not have all the functionality for FTP that QFTP did and building QFTP with the newest versions of Qt is problematic at best. Killing the SQL module would probably mean the end of Qt for our organization. I realize that cutting edge stuff is more fun. But we live in a world where our customers keep old equipment around for decades and they are willing to pay to keep it running. So we still have to support Windows NT 4 and RHEL 4 even though it’s not as fun as working with the latest and greatest. So please, I beg of you, do not remove any functionality without a complete, viable, fully functional replacement. Karl On Apr 23, 2015, at 9:35 AM, Jason H jh...@gmx.com wrote: Very true. If you need something like that to be agnostic, then you need to use a query builder or ORM. But it's not like Qt is very agnostic. Pragmatically speaking, the lack of constistent binding across of drivers kills it right out of the gate. In days like this, where NoSQL is an emerging trend I can't see anything really happening at the SQL module anymore. Sent: Thursday, April 23, 2015 at 1:48 AM From: André Somers an...@familiesomers.nl To: interest@qt-project.org Subject: Re: [Interest] QtSql database insertion issues... Jason H schreef op 23-4-2015 om 04:38: I always execute CREATE TABLE IF NOT EXISTS table after connecting. Problem is: there is no DDL support in Qt, so it is not possible to do that in a way that is database-agnostic. Your code will not work against all databases I think. André ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest http://lists.qt-project.org/mailman/listinfo/interest___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
As pertaining to kill: only talking about being fully DB-abstracted. at a source level. As pertaining to removing QtSQL: I meant nothing of the sort. I just dont expect it to be high on the list for someone to refactor the code to provide universally supported parameter bindings. Sent:Thursday, April 23, 2015 at 10:45 AM From:Karl Ruetz karl.ru...@ruetzdogz.com To:interest@qt-project.org Subject:Re: [Interest] QtSql database insertion issues... I sincerely hope you are wrong; at least for the next several years. (Like 10 years.) Staying on the bleeding edge is simply not an option for many of us that are simply Qt users (not developers). It took us years to update to Qt 5 because they killed QFTP without a fully functional replacement. QNAM does not have all the functionality for FTP that QFTP did and building QFTP with the newest versions of Qt is problematic at best. Killing the SQL module would probably mean the end of Qt for our organization. I realize that cutting edge stuff is more fun. But we live in a world where our customers keep old equipment around for decades and they are willing to pay to keep it running. So we still have to support Windows NT 4 and RHEL 4 even though its not as fun as working with the latest and greatest. So please, I beg of you, do not remove any functionality without a complete, viable, fully functional replacement. Karl On Apr 23, 2015, at 9:35 AM, Jason H jh...@gmx.com wrote: Very true. If you need something like that to be agnostic, then you need to use a query builder or ORM. But its not like Qt is very agnostic. Pragmatically speaking, the lack of constistent binding across of drivers kills it right out of the gate. In days like this, where NoSQL is an emerging trend I cant see anything really happening at the SQL module anymore. Sent:Thursday, April 23, 2015 at 1:48 AM From:Andr Somers an...@familiesomers.nl To:interest@qt-project.org Subject:Re: [Interest] QtSql database insertion issues... Jason H schreef op 23-4-2015 om 04:38: I always execute CREATE TABLE IF NOT EXISTS table after connecting. Problem is: there is no DDL support in Qt, so it is not possible to do that in a way that is database-agnostic. Your code will not work against all databases I think. Andr ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
I had thought about that which is why I dumped the boundValues() as part of the error after exec(). I'll try dumping prior to exec(). However, it didn't seem to matter whether I used position or named bindings, the results were the same. Ben On Wednesday, April 22, 2015 3:55 AM, Tony Rietwyk t...@rightsoft.com.au wrote: #yiv1822332023 #yiv1822332023 -- _filtered #yiv1822332023 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv1822332023 {font-family:PMingLiU;panose-1:2 2 5 0 0 0 0 0 0 0;} _filtered #yiv1822332023 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv1822332023 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv1822332023 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv1822332023 {panose-1:2 2 5 0 0 0 0 0 0 0;}#yiv1822332023 #yiv1822332023 p.yiv1822332023MsoNormal, #yiv1822332023 li.yiv1822332023MsoNormal, #yiv1822332023 div.yiv1822332023MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1822332023 a:link, #yiv1822332023 span.yiv1822332023MsoHyperlink {color:blue;text-decoration:underline;}#yiv1822332023 a:visited, #yiv1822332023 span.yiv1822332023MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv1822332023 p.yiv1822332023MsoAcetate, #yiv1822332023 li.yiv1822332023MsoAcetate, #yiv1822332023 div.yiv1822332023MsoAcetate {margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}#yiv1822332023 p.yiv1822332023msonormal, #yiv1822332023 li.yiv1822332023msonormal, #yiv1822332023 div.yiv1822332023msonormal {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1822332023 p.yiv1822332023msochpdefault, #yiv1822332023 li.yiv1822332023msochpdefault, #yiv1822332023 div.yiv1822332023msochpdefault {margin-right:0cm;margin-left:0cm;font-size:12.0pt;}#yiv1822332023 span.yiv1822332023msohyperlink {}#yiv1822332023 span.yiv1822332023msohyperlinkfollowed {}#yiv1822332023 span.yiv1822332023emailstyle17 {}#yiv1822332023 p.yiv1822332023msonormal1, #yiv1822332023 li.yiv1822332023msonormal1, #yiv1822332023 div.yiv1822332023msonormal1 {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1822332023 span.yiv1822332023msohyperlink1 {color:blue;text-decoration:underline;}#yiv1822332023 span.yiv1822332023msohyperlinkfollowed1 {color:purple;text-decoration:underline;}#yiv1822332023 span.yiv1822332023emailstyle171 {color:#1F497D;}#yiv1822332023 p.yiv1822332023msochpdefault1, #yiv1822332023 li.yiv1822332023msochpdefault1, #yiv1822332023 div.yiv1822332023msochpdefault1 {margin-right:0cm;margin-left:0cm;font-size:10.0pt;}#yiv1822332023 span.yiv1822332023EmailStyle27 {color:#1F497D;}#yiv1822332023 span.yiv1822332023BalloonTextChar {}#yiv1822332023 .yiv1822332023MsoChpDefault {font-size:10.0pt;} _filtered #yiv1822332023 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv1822332023 div.yiv1822332023WordSection1 {}#yiv1822332023 Not all drivers support named bindings. If it doesn't, then the driver replaces them with positional ? during execute. Try dumping insertion.boundValues() before calling exec. Otherwise, I think you'll need to step through in a debug build and set a breakpoint in Qt where the error is raised. Tony From: BRM [mailto:bm_witn...@yahoo.com] Sent: Wednesday, 22 April 2015 2:12 PM To: Tony Rietwyk; 'Qt Project' Subject: Re: [Interest] QtSql database insertion issues... The prepare(...) does seem to work. One thing that really confuses me is that even though I use the named bindings, it always lists the bindings as '?' in the error messages. Ben On Tuesday, April 21, 2015 11:20 PM, Tony Rietwyk t...@rightsoft.com.au wrote: Hi Ben, Does the prepare work? I assume the database must be open, or you would get a different message. Hope that helps, Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM Sent: Wednesday, 22 April 2015 12:42 PM To: Qt Project Subject: [Interest] QtSql database insertion issues... I've been out of the Qt loop for a little bit; but I'm working to bring myself back up to speed.I'm presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where I'm attempting to store the data in a SQLite Database during run-time. I've already done a command-line version using python, and I'm pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, I'm doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value
Re: [Interest] QtSql database insertion issues...
So I dove in more tonight; and discovered a rather dumb mistake - I forgot to initialize the database (e.g load the schema). prepare() had failed sometimes and other times not; seemed to be based on compile. Any how...it failed reliably tonight and when I added the lastError() data to the qDebug() statements it was evident that the tables were missing. Fixed that and...now it works. :) Thanks for everyone that looked at it, and the ideas. Now on to finishing the functionality... Ben On Wednesday, April 22, 2015 12:12 AM, BRM bm_witn...@yahoo.com wrote: The prepare(...) does seem to work. One thing that really confuses me is that even though I use the named bindings, it always lists the bindings as '?' in the error messages. Ben On Tuesday, April 21, 2015 11:20 PM, Tony Rietwyk t...@rightsoft.com.au wrote: #yiv8114132949 -- filtered {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}#yiv8114132949 filtered {font-family:PMingLiU;panose-1:2 2 5 0 0 0 0 0 0 0;}#yiv8114132949 filtered {panose-1:2 4 5 3 5 4 6 3 2 4;}#yiv8114132949 filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv8114132949 filtered {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}#yiv8114132949 filtered {panose-1:2 2 5 0 0 0 0 0 0 0;}#yiv8114132949 p.yiv8114132949MsoNormal, #yiv8114132949 li.yiv8114132949MsoNormal, #yiv8114132949 div.yiv8114132949MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv8114132949 a:link, #yiv8114132949 span.yiv8114132949MsoHyperlink {color:blue;text-decoration:underline;}#yiv8114132949 a:visited, #yiv8114132949 span.yiv8114132949MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv8114132949 span.yiv8114132949EmailStyle17 {color:#1F497D;}#yiv8114132949 .yiv8114132949MsoChpDefault {font-size:10.0pt;}#yiv8114132949 filtered {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv8114132949 div.yiv8114132949WordSection1 {}#yiv8114132949 Hi Ben, Does the prepare work? I assume the database must be open, or you would get a different message. Hope that helps, Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM Sent: Wednesday, 22 April 2015 12:42 PM To: Qt Project Subject: [Interest] QtSql database insertion issues... I've been out of the Qt loop for a little bit; but I'm working to bring myself back up to speed.I'm presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where I'm attempting to store the data in a SQLite Database during run-time. I've already done a command-line version using python, and I'm pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, I'm doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value bindings; I've added debug output that shows the values being bound; however, it continues to complain about a parameter mismatch. You can see the output here:https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17 I've tried binding both by name (preferred) and by order. (I have a C Preprocessor Define to control it); but neither are working. This is my first time really playing with a database via Qt.What am I doing wrong? TIA, Ben ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
I always execute CREATE TABLE IF NOT EXISTS table after connecting. Sent:Wednesday, April 22, 2015 at 10:08 PM From:BRM bm_witn...@yahoo.com To:Tony Rietwyk t...@rightsoft.com.au, Qt Project interest@qt-project.org Subject:Re: [Interest] QtSql database insertion issues... So I dove in more tonight; and discovered a rather dumb mistake - I forgot to initialize the database (e.g load the schema). prepare() had failed sometimes and other times not; seemed to be based on compile. Any how...it failed reliably tonight and when I added the lastError() data to the qDebug() statements it was evident that the tables were missing. Fixed that and...now it works. :) Thanks for everyone that looked at it, and the ideas. Now on to finishing the functionality... Ben On Wednesday, April 22, 2015 12:12 AM, BRM bm_witn...@yahoo.com wrote: The prepare(...) does seem to work. One thing that really confuses me is that even though I use the named bindings, it always lists the bindings as ? in the error messages. Ben On Tuesday, April 21, 2015 11:20 PM, Tony Rietwyk t...@rightsoft.com.au wrote: Hi Ben, Does the prepare work? I assume the database must be open, or you would get a different message. Hope that helps, Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM Sent: Wednesday, 22 April 2015 12:42 PM To: Qt Project Subject: [Interest] QtSql database insertion issues... Ive been out of the Qt loop for a little bit; but Im working to bring myself back up to speed. Im presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where Im attempting to store the data in a SQLite Database during run-time. Ive already done a command-line version using python, and Im pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp Im building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, Im doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value bindings; Ive added debug output that shows the values being bound; however, it continues to complain about a parameter mismatch. You can see the output here: https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17 Ive tried binding both by name (preferred) and by order. (I have a C Preprocessor Define to control it); but neither are working. This is my first time really playing with a database via Qt. What am I doing wrong? TIA, Ben ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
Jason H schreef op 23-4-2015 om 04:38: I always execute CREATE TABLE IF NOT EXISTS table after connecting. Problem is: there is no DDL support in Qt, so it is not possible to do that in a way that is database-agnostic. Your code will not work against all databases I think. André ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
Kristoffersen, Even (NO14) schreef op 22-4-2015 om 09:07: insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); TIA, Ben Seems like you are missing a semicolon at the end of your SQL statements. That shouldn't matter. There is no obligation to terminate an SQL statement with a semicolon. André ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); TIA, Ben Seems like you are missing a semicolon at the end of your SQL statements. -Even ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QtSql database insertion issues...
I've been out of the Qt loop for a little bit; but I'm working to bring myself back up to speed.I'm presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where I'm attempting to store the data in a SQLite Database during run-time. I've already done a command-line version using python, and I'm pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, I'm doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value bindings; I've added debug output that shows the values being bound; however, it continues to complain about a parameter mismatch. You can see the output here: https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17 I've tried binding both by name (preferred) and by order. (I have a C Preprocessor Define to control it); but neither are working. This is my first time really playing with a database via Qt. What am I doing wrong? TIA, Ben ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
Hi Ben, Does the prepare work? I assume the database must be open, or you would get a different message. Hope that helps, Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM Sent: Wednesday, 22 April 2015 12:42 PM To: Qt Project Subject: [Interest] QtSql database insertion issues... I've been out of the Qt loop for a little bit; but I'm working to bring myself back up to speed. I'm presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where I'm attempting to store the data in a SQLite Database during run-time. I've already done a command-line version using python, and I'm pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, I'm doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value bindings; I've added debug output that shows the values being bound; however, it continues to complain about a parameter mismatch. You can see the output here: https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17 I've tried binding both by name (preferred) and by order. (I have a C Preprocessor Define to control it); but neither are working. This is my first time really playing with a database via Qt. What am I doing wrong? TIA, Ben ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtSql database insertion issues...
The prepare(...) does seem to work. One thing that really confuses me is that even though I use the named bindings, it always lists the bindings as '?' in the error messages. Ben On Tuesday, April 21, 2015 11:20 PM, Tony Rietwyk t...@rightsoft.com.au wrote: #yiv1136875381 #yiv1136875381 -- _filtered #yiv1136875381 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv1136875381 {font-family:PMingLiU;panose-1:2 2 5 0 0 0 0 0 0 0;} _filtered #yiv1136875381 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv1136875381 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv1136875381 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv1136875381 {panose-1:2 2 5 0 0 0 0 0 0 0;}#yiv1136875381 #yiv1136875381 p.yiv1136875381MsoNormal, #yiv1136875381 li.yiv1136875381MsoNormal, #yiv1136875381 div.yiv1136875381MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv1136875381 a:link, #yiv1136875381 span.yiv1136875381MsoHyperlink {color:blue;text-decoration:underline;}#yiv1136875381 a:visited, #yiv1136875381 span.yiv1136875381MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv1136875381 span.yiv1136875381EmailStyle17 {color:#1F497D;}#yiv1136875381 .yiv1136875381MsoChpDefault {font-size:10.0pt;} _filtered #yiv1136875381 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv1136875381 div.yiv1136875381WordSection1 {}#yiv1136875381 Hi Ben, Does the prepare work? I assume the database must be open, or you would get a different message. Hope that helps, Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM Sent: Wednesday, 22 April 2015 12:42 PM To: Qt Project Subject: [Interest] QtSql database insertion issues... I've been out of the Qt loop for a little bit; but I'm working to bring myself back up to speed.I'm presently working on a small project that is basically a GUI equivalent of md5sum/sha1sum where I'm attempting to store the data in a SQLite Database during run-time. I've already done a command-line version using python, and I'm pulling the SQL statements from there. However, I am having trouble with the QSqlQuery prepared statements. The entire code chunk is here: https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided by the distro. To summarize the code, I'm doing the following: QSqlQuery insertion(myDb); insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, :path)); insertion.bindValue(:hash, some hash); insertion.bindValue(:path, /some/path); if (!insertion.exec()) qDebug() insertion failed. Log errors and value bindings; I've added debug output that shows the values being bound; however, it continues to complain about a parameter mismatch. You can see the output here:https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17 I've tried binding both by name (preferred) and by order. (I have a C Preprocessor Define to control it); but neither are working. This is my first time really playing with a database via Qt.What am I doing wrong? TIA, Ben ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest