{"action":"closed","issue":{"url":"https://api.github.com/repos/domoticz/domoticz/issues/659","repository_url":"https://api.github.com/repos/domoticz/domoticz","labels_url":"https://api.github.com/repos/domoticz/domoticz/issues/659/labels{/name}","comments_url":"https://api.github.com/repos/domoticz/domoticz/issues/659/comments","events_url":"https://api.github.com/repos/domoticz/domoticz/issues/659/events","html_url":"https://github.com/domoticz/domoticz/issues/659","id":154892565,"number":659,"title":"SQLHelper::OpenDatabase suspect iterator increment","user":{"login":"deece","id":1862055,"avatar_url":"https://avatars.githubusercontent.com/u/1862055?v=3","gravatar_id":"","url":"https://api.github.com/users/deece","html_url":"https://github.com/deece","followers_url":"https://api.github.com/users/deece/followers","following_url":"https://api.github.com/users/deece/following{/other_user}","gists_url":"https://api.github.com/users/deece/gists{/gist_id}","starred_url":"https://api.github.com/users/deece/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deece/subscriptions","organizations_url":"https://api.github.com/users/deece/orgs","repos_url":"https://api.github.com/users/deece/repos","events_url":"https://api.github.com/users/deece/events{/privacy}","received_events_url":"https://api.github.com/users/deece/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-15T06:01:07Z","updated_at":"2016-05-15T09:58:03Z","closed_at":"2016-05-15T09:58:03Z","body":"in the database upgrade code, this looks odd, as the iterator 'itt' is incremented twice:\r\n\r\n```\r\n\t\tif (dbversion < 12)\r\n\t\t{\r\n\t\t\tstd::vector<std::vector<std::string> > result;\r\n\t\t\tresult = query(\"SELECT t.RowID, u.RowID from MultiMeter_Calendar as t, MultiMeter_Calendar as u WHERE (t.[Date] == u.[Date]) AND (t.[DeviceRowID] == u.[DeviceRowID]) AND (t.[RowID] != u.[RowID])\");\r\n\t\t\tif (result.size() > 0)\r\n\t\t\t{\r\n\t\t\t\tstd::vector<std::vector<std::string> >::const_iterator itt;\r\n\t\t\t\tfor (itt = result.begin(); itt != result.end(); ++itt)\r\n\t\t\t\t{\r\n\t\t\t\t\t++itt;\r\n\t\t\t\t\tstd::vector<std::string> sd = *itt;\r\n\t\t\t\t\tsafe_query(\"DELETE FROM MultiMeter_Calendar WHERE (RowID=='%q')\", sd[0].c_str());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n```"}}