{"action":"opened","issue":{"url":"https://api.github.com/repos/inaka/sumo_db/issues/202","labels_url":"https://api.github.com/repos/inaka/sumo_db/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/inaka/sumo_db/issues/202/comments","events_url":"https://api.github.com/repos/inaka/sumo_db/issues/202/events","html_url":"https://github.com/inaka/sumo_db/issues/202","id":109699552,"number":202,"title":"Invalid Prepared Statements.","user":{"login":"kevinmontuori","id":69041,"avatar_url":"https://avatars.githubusercontent.com/u/69041?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinmontuori","html_url":"https://github.com/kevinmontuori","followers_url":"https://api.github.com/users/kevinmontuori/followers","following_url":"https://api.github.com/users/kevinmontuori/following{/other_user}","gists_url":"https://api.github.com/users/kevinmontuori/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinmontuori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinmontuori/subscriptions","organizations_url":"https://api.github.com/users/kevinmontuori/orgs","repos_url":"https://api.github.com/users/kevinmontuori/repos","events_url":"https://api.github.com/users/kevinmontuori/events{/privacy}","received_events_url":"https://api.github.com/users/kevinmontuori/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-04T19:32:13Z","updated_at":"2015-10-04T19:32:13Z","closed_at":null,"body":"Hi -- I'm having an issue with sumo:persist/2 (using the MySQL store) where initial calls to a store work just fine but subsequent calls with a different number of map elements fail with an \"Incorrect arguments to EXECUTE\" error.  Here's a minimal example of what I mean and the query log that accompanies it:\r\n\r\n```erlang\r\n-module(sumo_test).\r\n-behavior(sumo_doc).\r\n\r\n-export([sumo_sleep/1, sumo_wakeup/1, sumo_schema/0]).\r\n\r\n-export([test/0]).\r\n\r\nsumo_sleep(Data) -> Data.\r\n\r\nsumo_wakeup(Data) -> Data.\r\n\r\nsumo_schema() -> sumo:new_schema(?MODULE, [\r\n  sumo:new_field(id,     string,  [{length, 36}, id, not_null]),\r\n  sumo:new_field(name,   string,  [{length, 16}]),\r\n  sumo:new_field(age,    integer, []),\r\n  sumo:new_field(weight, text,    []) ]).\r\n\r\ntest() ->\r\n  X = #{ id => \"one\", weight => \"120 lbs.\" },\r\n  Y = #{ id => \"two\", name => \"Joe Quuxor\", age => 22},\r\n  sumo:persist(?MODULE, X),\r\n  sumo:persist(?MODULE, Y).\r\n```\r\n\r\n```\r\n[debug] sumo_store_mysql:log:478 Preparing query: sumo_test_update_stmt: <<\"INSERT INTO `sumo_test` (`weight`,`id`) VALUES (?,?) ON DUPLICATE KEY UPDATE `weight`=?\">>\r\n[debug] sumo_store_mysql:log:478 Executed Query: sumo_test_update_stmt -> [\"120 lbs.\",\"one\",\"120 lbs.\"] (110.633ms)\r\n[debug] sumo_store_mysql:log:478 Using already prepared query: sumo_test_update_stmt: {1,<<\"INSERT INTO `sumo_test` (`weight`,`id`) VALUES (?,?) ON DUPLICATE KEY UPDATE `weight`=?\">>}\r\n[debug] sumo_store_mysql:log:478 Executed Query: sumo_test_update_stmt -> [\"Joe Quuxor\",\"two\",22,\"Joe Quuxor\",22] (1.566ms)\r\n** exception throw: {error,<<\"HY000:Incorrect arguments to EXECUTE\">>}\r\n     in function  sumo:persist/2 (.../_build/default/lib/sumo_db/src/sumo.erl, line 185)\r\n```\r\n\r\nI don't think I'm doing anything that should be invalid here but please let me know if the error's on my end.  Thanks!\r\n"}}