Hi, I have installed the sqlite-net nuget package, which comes with 2 cs files: SQLite.cs and SQLiteAsync.cs.
SQLite.cs
contains a class called SQLite3
which contains the method:
[DllImport("sqlite3", EntryPoint = "sqlite3_win32_set_directory", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
public static extern int SetDirectory(uint directoryType, string directoryPath);
I see that the SQLiteConnection
constructor has the following code:
#if NETFX_CORE
SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif
But why?! What does this do and why does it need to be set each time a new SQLiteConnection is created? It seems like I get sporadic AccessViolationExceptions
with this line.
Update
I found the documentation for this method but still don't understand the purpose of the TempDirectory. What gets written there?
/*
** This function sets the data directory or the temporary directory based on
** the provided arguments. The type argument must be 1 in order to set the
** data directory or 2 in order to set the temporary directory. The zValue
** argument is the name of the directory to use. The return value will be
** SQLITE_OK if successful.
*/