{"action":"closed","issue":{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/116","labels_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/116/comments","events_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/116/events","html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/issues/116","id":101871854,"number":116,"title":"Transaction fails due to invalid temporary directory on UWP","user":{"login":"AlekseyMartynov","id":4426185,"avatar_url":"https://avatars.githubusercontent.com/u/4426185?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyMartynov","html_url":"https://github.com/AlekseyMartynov","followers_url":"https://api.github.com/users/AlekseyMartynov/followers","following_url":"https://api.github.com/users/AlekseyMartynov/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyMartynov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyMartynov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyMartynov/subscriptions","organizations_url":"https://api.github.com/users/AlekseyMartynov/orgs","repos_url":"https://api.github.com/users/AlekseyMartynov/repos","events_url":"https://api.github.com/users/AlekseyMartynov/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyMartynov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/labels/2%20-%20Done","name":"2 - Done","color":"CCCCCC"},{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/labels/pri0","name":"pri0","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"natemcmaster","id":2696087,"avatar_url":"https://avatars.githubusercontent.com/u/2696087?v=3","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/milestones/5","html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/milestones/1.0.0-rc1","labels_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/milestones/5/labels","id":1047783,"number":5,"title":"1.0.0-rc1","description":"","creator":{"login":"bricelam","id":1226749,"avatar_url":"https://avatars.githubusercontent.com/u/1226749?v=3","gravatar_id":"","url":"https://api.github.com/users/bricelam","html_url":"https://github.com/bricelam","followers_url":"https://api.github.com/users/bricelam/followers","following_url":"https://api.github.com/users/bricelam/following{/other_user}","gists_url":"https://api.github.com/users/bricelam/gists{/gist_id}","starred_url":"https://api.github.com/users/bricelam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricelam/subscriptions","organizations_url":"https://api.github.com/users/bricelam/orgs","repos_url":"https://api.github.com/users/bricelam/repos","events_url":"https://api.github.com/users/bricelam/events{/privacy}","received_events_url":"https://api.github.com/users/bricelam/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":8,"state":"open","created_at":"2015-03-31T21:47:42Z","updated_at":"2015-10-30T23:51:11Z","due_on":"2015-11-30T08:00:00Z","closed_at":null},"comments":9,"created_at":"2015-08-19T11:39:26Z","updated_at":"2015-10-30T23:51:11Z","closed_at":"2015-10-30T23:51:11Z","body":"(Not sure whether this library is meant to be usable in UAP, but based on https://github.com/aspnet/dnx/issues/2302 I suppose that yes. Currently it works fine when referenced directly).\r\n\r\nIn UAP you need to adjust SQLite temp path (see similar issue https://github.com/oysteinkrog/SQLite.Net-PCL/pull/157). Without it, certain scenarios involving DDL inside a transaction fail with \"SQL logic error\".\r\n\r\nRelated test case:\r\n\r\n    public MainPage() {\r\n        this.InitializeComponent();\r\n\r\n        var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, Guid.NewGuid().ToString());\r\n\r\n        // >>>>> this line is a fix\r\n        //SetDirectory(2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);\r\n\r\n        using(var conn = new SqliteConnection(\"data source=\" + dbPath)) {\r\n            conn.Open();\r\n            using(var cmd = conn.CreateCommand()) {\r\n                cmd.CommandText = @\"\r\n                    create table foo(id integer primary key, value integer);\r\n                    insert into foo(value) values ('a');\r\n\r\n                    begin; -- >>>>> this causes 'sql logic error'\r\n\r\n                    create table foo_copy(id integer primary key, value text);\r\n                    insert into foo_copy select * from foo;\r\n                \";\r\n                cmd.ExecuteNonQuery();\r\n            }\r\n        }\r\n    }\r\n\r\n    [DllImport(\"sqlite3\", EntryPoint = \"sqlite3_win32_set_directory\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]\r\n    static extern int SetDirectory(uint directoryType, string directoryPath);\r\n"}}