{"action":"opened","issue":{"url":"https://api.github.com/repos/artyom-beilis/cppcms/issues/37","repository_url":"https://api.github.com/repos/artyom-beilis/cppcms","labels_url":"https://api.github.com/repos/artyom-beilis/cppcms/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/artyom-beilis/cppcms/issues/37/comments","events_url":"https://api.github.com/repos/artyom-beilis/cppcms/issues/37/events","html_url":"https://github.com/artyom-beilis/cppcms/issues/37","id":321777379,"number":37,"title":"cppdb: show tables like query arguments not bound","user":{"login":"dreaming-augustin","id":1203641,"avatar_url":"https://avatars1.githubusercontent.com/u/1203641?v=4","gravatar_id":"","url":"https://api.github.com/users/dreaming-augustin","html_url":"https://github.com/dreaming-augustin","followers_url":"https://api.github.com/users/dreaming-augustin/followers","following_url":"https://api.github.com/users/dreaming-augustin/following{/other_user}","gists_url":"https://api.github.com/users/dreaming-augustin/gists{/gist_id}","starred_url":"https://api.github.com/users/dreaming-augustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreaming-augustin/subscriptions","organizations_url":"https://api.github.com/users/dreaming-augustin/orgs","repos_url":"https://api.github.com/users/dreaming-augustin/repos","events_url":"https://api.github.com/users/dreaming-augustin/events{/privacy}","received_events_url":"https://api.github.com/users/dreaming-augustin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-10T01:19:22Z","updated_at":"2018-05-10T01:19:22Z","closed_at":null,"author_association":"NONE","body":"The following: \r\n```\r\n#include <iostream>\r\n#include <cppdb/frontend.h>\r\n\r\nint main() {\r\n        std::string dbcs =\"mysql:database=mydb;user=myuser;password=mypassword;@pool_size=10;set_charset_name=utf8\";\r\n        auto sql = cppdb::session(dbcs);\r\n        cppdb::result res;\r\n        std::string table(\"my_table\");\r\n        res = sql << \"SHOW TABLES LIKE ?\" << table;\r\n        res.next();\r\n}\r\n```\r\nproduces:\r\n\r\n> terminate called after throwing an instance of 'cppdb::mysql_backend::cppdb_myerror'\r\n>   what():  cppdb::mysql::You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1\r\n> Aborted\r\n\r\nThe same code but with a different query (e.g. a SELECT query) can properly bind the arguments, but for some reason, the 'show tables' query above does not work with bound arguments.\r\n\r\nAlso, could cppdb_myerror output the full query? I checked the cppdb source code and I couldn't see any obvious way to have a more detailed error message being thrown. However, when developing an application, it is sometimes hard to debug code and queries because the exact query which causes to throw is not displayed. Above is a good example of that: the error thrown tell about \"the right syntax to use near '?' \", but it does not show the actually query \"SHOW TABLES LIKE ?\".     \r\nHow hard would it be for the full query to be thrown together with the error?   "}}
{"actor":{"display_login":"dreaming-augustin"}}