Discussion:
[soci-users] soci error
Pawel Aleksander Fedorynski
2013-08-15 10:00:49 UTC
Permalink
Hi Ben,

I'm on vacation now so I cannot test it, but from your description it seems
that MySQL starting with 5.5 stopped accepting

truncate 'test_table'

instead of

truncate test_table

since the variant with soci::use() escapes and quotes the string. I don't
see any way of fixing it since I can hardly stop quoting the all strings
passed to use(), and it would be very hard to parse the queries to decide
whether the string is a table name or something else.

Thanks,

Aleksander


On Wed, Aug 14, 2013 at 12:13 PM, Benedikt Greipl <
Hello Pawel,
I have a question on soci. Sorry for contacting you directly, but I
didn't find help elsewhere ...
After an update to Ubuntu 13.04 and MySQL 5.5, when I do
soci::session sql;
string table = "test_table"
sql << "truncate :table", soci::use(table);
soci throws an error that the SQL-Syntax isn't correct.
However,
sql << "truncate " + table;
works fine.
What's going on here? I'd really appreciate any help! Thank you!
Cheers,
Ben
Mateusz Loskot
2013-08-15 13:44:27 UTC
Permalink
Post by Pawel Aleksander Fedorynski
Hi Ben,
I'm on vacation now so I cannot test it, but from your description it seems
that MySQL starting with 5.5 stopped accepting
truncate 'test_table'
instead of
truncate test_table
since the variant with soci::use() escapes and quotes the string. I don't
see any way of fixing it since I can hardly stop quoting the all strings
passed to use(), and it would be very hard to parse the queries to decide
whether the string is a table name or something else.
Thanks,
Aleksander
On Wed, Aug 14, 2013 at 12:13 PM, Benedikt Greipl
Hello Pawel,
I have a question on soci. Sorry for contacting you directly, but I
didn't find help elsewhere ...
After an update to Ubuntu 13.04 and MySQL 5.5, when I do
soci::session sql;
string table = "test_table"
sql << "truncate :table", soci::use(table);
soci throws an error that the SQL-Syntax isn't correct.
However,
sql << "truncate " + table;
works fine.
By the way, it would be good to add this case to the tests.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
"Participation in this whole process is a form of torture" ~~ Szalony,
wspinanie.pl
Loading...