{"action":"opened","issue":{"url":"https://api.github.com/repos/satyan/sugar/issues/649","repository_url":"https://api.github.com/repos/satyan/sugar","labels_url":"https://api.github.com/repos/satyan/sugar/issues/649/labels{/name}","comments_url":"https://api.github.com/repos/satyan/sugar/issues/649/comments","events_url":"https://api.github.com/repos/satyan/sugar/issues/649/events","html_url":"https://github.com/satyan/sugar/issues/649","id":168362851,"number":649,"title":"UPDATE query with any @Unique columns","user":{"login":"kinlhp","id":12128309,"avatar_url":"https://avatars.githubusercontent.com/u/12128309?v=3","gravatar_id":"","url":"https://api.github.com/users/kinlhp","html_url":"https://github.com/kinlhp","followers_url":"https://api.github.com/users/kinlhp/followers","following_url":"https://api.github.com/users/kinlhp/following{/other_user}","gists_url":"https://api.github.com/users/kinlhp/gists{/gist_id}","starred_url":"https://api.github.com/users/kinlhp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinlhp/subscriptions","organizations_url":"https://api.github.com/users/kinlhp/orgs","repos_url":"https://api.github.com/users/kinlhp/repos","events_url":"https://api.github.com/users/kinlhp/events{/privacy}","received_events_url":"https://api.github.com/users/kinlhp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-29T16:26:23Z","updated_at":"2016-07-29T16:26:23Z","closed_at":null,"body":"Hi, **I am Brazilian** and **I used a translator to write this text** - then I'm sorry for any misspelling. \r\nScenario: \r\nan object that has two attributes with **_@Unique_**, and the time to do an **_UPDATE_** on table records get the following exception: \r\n`android.database.sqlite.SQLiteException: near \"nome_cidade\": syntax error (code 1): , while compiling: UPDATE cidade SET sincronizacao=?,ultima_alteracao=?,ativo=?,hash=?,uf=? WHERE ibge = ?nome_cidade = ?` \r\nI noticed the following detail on this query **_UPDATE_**: `... WHERE ibge = ?nome_cidade = ?`. \r\nLooking well, it notes that should be `... WHERE ibge = ? AND nome_cidade = ?`. \r\nScouring the framework for possible solutions, I came on the next line **_com.orm.SugarRecord.update (SugarRecord.java: 332)_**: \r\n`whereClause.append(columnName).append(\" = ?\");` \r\nIt is not generating the query up correctly - eg `WHERE foo = x AND bar = Y` -, is despising the clause AND. \r\nI do not know if anyone has reported the same situation, but in any case is there. \r\n\r\nA curiosity is the issue of non-use of **_PRIMARY KEY_** to control the tuple that receive **_UPDATE_** - I know it has been said http://stackoverflow.com/a/28119201 - as is standard in **_SQL_**. \r\n\r\nAlready, thank you for the excellent **_ORM_** that has helped me a lot. \r\n\r\nBig hug. "}}
{"actor":{"display_login":"kinlhp"}}