{"action":"created","issue":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/472","repository_url":"https://api.github.com/repos/go-sql-driver/mysql","labels_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/472/labels{/name}","comments_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/472/comments","events_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/472/events","html_url":"https://github.com/go-sql-driver/mysql/issues/472","id":168843934,"number":472,"title":"Transaction Level","user":{"login":"pjebs","id":5377970,"avatar_url":"https://avatars.githubusercontent.com/u/5377970?v=3","gravatar_id":"","url":"https://api.github.com/users/pjebs","html_url":"https://github.com/pjebs","followers_url":"https://api.github.com/users/pjebs/followers","following_url":"https://api.github.com/users/pjebs/following{/other_user}","gists_url":"https://api.github.com/users/pjebs/gists{/gist_id}","starred_url":"https://api.github.com/users/pjebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjebs/subscriptions","organizations_url":"https://api.github.com/users/pjebs/orgs","repos_url":"https://api.github.com/users/pjebs/repos","events_url":"https://api.github.com/users/pjebs/events{/privacy}","received_events_url":"https://api.github.com/users/pjebs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-08-02T09:51:58Z","updated_at":"2016-08-02T10:36:17Z","closed_at":null,"body":"I was wondering what the best way was to set the transaction level and have it revert back to default after the transaction - particularly in case of a panic:\r\n\r\nI'm currently doing this:\r\n\r\n\r\n```\r\n\tif err := gorm.Exec(\"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\").Error; err != nil {\r\n\t\t//Handle Error\r\n\t\treturn\r\n\t}\r\n\ttx := gorm.Begin()\r\n\r\n...\r\n\r\n\t//Do something with tx. And call `tx.Rollback()` or `tx.Commit()`\r\n```"},"comment":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/comments/236867367","html_url":"https://github.com/go-sql-driver/mysql/issues/472#issuecomment-236867367","issue_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/472","id":236867367,"user":{"login":"pjebs","id":5377970,"avatar_url":"https://avatars.githubusercontent.com/u/5377970?v=3","gravatar_id":"","url":"https://api.github.com/users/pjebs","html_url":"https://github.com/pjebs","followers_url":"https://api.github.com/users/pjebs/followers","following_url":"https://api.github.com/users/pjebs/following{/other_user}","gists_url":"https://api.github.com/users/pjebs/gists{/gist_id}","starred_url":"https://api.github.com/users/pjebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjebs/subscriptions","organizations_url":"https://api.github.com/users/pjebs/orgs","repos_url":"https://api.github.com/users/pjebs/repos","events_url":"https://api.github.com/users/pjebs/events{/privacy}","received_events_url":"https://api.github.com/users/pjebs/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T10:36:17Z","updated_at":"2016-08-02T10:36:17Z","body":"I believe that system variable changes the default transaction level for everything, whereas I only want to change the transaction level for 1 particular query.\r\n\r\nUsing `sql.DB` won't help. It will just use underlying mysql driver and its connection pooling. In fact, I create a `sql.DB` and feed it into gorm, without allowing gorm to manage it for me.\r\n\r\nI've known of that alternative driver but been hesitant to use it because it doesn't have anywhere near active user base (hence very few updates). "}}
{"actor":{"display_login":"pjebs"}}