{"action":"created","issue":{"url":"https://api.github.com/repos/roistat/go-clickhouse/issues/7","repository_url":"https://api.github.com/repos/roistat/go-clickhouse","labels_url":"https://api.github.com/repos/roistat/go-clickhouse/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/roistat/go-clickhouse/issues/7/comments","events_url":"https://api.github.com/repos/roistat/go-clickhouse/issues/7/events","html_url":"https://github.com/roistat/go-clickhouse/issues/7","id":185102873,"number":7,"title":"Back slash broke parsing url","user":{"login":"njspok","id":1404034,"avatar_url":"https://avatars.githubusercontent.com/u/1404034?v=3","gravatar_id":"","url":"https://api.github.com/users/njspok","html_url":"https://github.com/njspok","followers_url":"https://api.github.com/users/njspok/followers","following_url":"https://api.github.com/users/njspok/following{/other_user}","gists_url":"https://api.github.com/users/njspok/gists{/gist_id}","starred_url":"https://api.github.com/users/njspok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njspok/subscriptions","organizations_url":"https://api.github.com/users/njspok/orgs","repos_url":"https://api.github.com/users/njspok/repos","events_url":"https://api.github.com/users/njspok/events{/privacy}","received_events_url":"https://api.github.com/users/njspok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-25T12:29:10Z","updated_at":"2016-10-25T13:10:01Z","closed_at":null,"body":"When i call query.Exec() and calls prepareHttp() return string with incorrect query. Back slash not escaped and i get some error from click house server:\r\n```\r\npanic: [error code=27 message=\"DB::Exception: Cannot parse input: expected , before: 53.0.2785.143','Windows 8.1',0,1,0,0,1366,768,1366,728,'GA1.2.106696037.1475139446','1475139447154558963',3009207953,'<(60.7076,28.7528),20>',0): (at row 10)\"]\r\n```\r\n\r\nOriginal query\r\n```sql\r\nINSERT INTO event (id,event_type_id,created_date,created_at,ip,user_id,url_host_id,url_path,url_query,browser_id,browser_version,operation_system,device_type_id,country_id,test_version,test_segment,screen_width,screen_height,view_port_width,view_port_height,google_uid,yandex_uid,page_type_id,location,session_id) \r\nVALUES \r\n(2038956206,17,'2016-10-22','2016-10-22 00:27:19','176.125.161.207/32','UlWlI7UcD6f5q0xz',4063345517,'/search/p4/','f=null&q=%D0%BF%D0%B0%D0%BA%D0%B5%D1%82%20%D0%BF%D0%BE%D0%BB%D0%B8%D1%8D%D1%82%D0%B8%D0%BB%D0%B5%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9\\',4269441498,'53.0.2785.143','Windows 8.1',0,1,0,0,1366,768,1366,728,'GA1.2.106696037.1475139446','1475139447154558963',3009207953,'<(60.7076,28.7528),20>',0)\r\n```\r\nString ends back slash, when  i remove him server accept request `'f=null&q=%D0%BF%D0%B0%D0%BA%D0%B5%D1%82%20%D0%BF%D0%BE%D0%BB%D0%B8%D1%8D%D1%82%D0%B8%D0%BB%D0%B5%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9\\'`"},"comment":{"url":"https://api.github.com/repos/roistat/go-clickhouse/issues/comments/256029755","html_url":"https://github.com/roistat/go-clickhouse/issues/7#issuecomment-256029755","issue_url":"https://api.github.com/repos/roistat/go-clickhouse/issues/7","id":256029755,"user":{"login":"njspok","id":1404034,"avatar_url":"https://avatars.githubusercontent.com/u/1404034?v=3","gravatar_id":"","url":"https://api.github.com/users/njspok","html_url":"https://github.com/njspok","followers_url":"https://api.github.com/users/njspok/followers","following_url":"https://api.github.com/users/njspok/following{/other_user}","gists_url":"https://api.github.com/users/njspok/gists{/gist_id}","starred_url":"https://api.github.com/users/njspok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njspok/subscriptions","organizations_url":"https://api.github.com/users/njspok/orgs","repos_url":"https://api.github.com/users/njspok/repos","events_url":"https://api.github.com/users/njspok/events{/privacy}","received_events_url":"https://api.github.com/users/njspok/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T13:10:01Z","updated_at":"2016-10-25T13:10:01Z","body":"Maybe this function\r\n```go\r\n// Literal escape the given string.\r\nfunc Literal(s string) string {\r\n\tp := \"\"\r\n\r\n\tif strings.Contains(s, `\\`) {\r\n\t\tp = \"E\"\r\n\t}\r\n\r\n\ts = strings.Replace(s, `'`, `''`, -1)\r\n\ts = strings.Replace(s, `\\`, `\\\\`, -1)\r\n\treturn p + `'` + s + `'`\r\n}\r\n```\r\nhttps://github.com/tj/go-pg-escape/blob/master/escape.go#L40"}}
{"actor":{"display_login":"njspok"}}