On 18 Mar 2013, at 7:02pm, Marco Bambini <ma...@sqlabs.net> wrote: > The main issue is that sqlite uses temporary files (next to the database > file) to store wal, shm or journal information. > > Apple simply does not grant read/write privileges on non user specifically > selected files… so there is no way for sqlite to create temporary information. > A solution could be to just set journal_mode to MEMORY but database got > corrupted in case of crash or power off and does not seem a very good > solution. > Another solution could be to have the ability to specify a directory for all > these files… but there could be a lot of side effect.
That last option of yours is the one which seems likely to be most useful. Under iOS and sandboxed apps each user and each app does have its own place here where private files or folders can be safely stored. The operating system does supply a call which returns the path to this folder. So it seems like simple tests ("Am I running under MacOS ? Then use this call to return the path for temp files.") are the way to go. One way to find these useful directories is to use the '$' variables listed at the end of this page: <http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/MigratingALegacyApp/MigratingAnAppToASandbox.html#//apple_ref/doc/uid/TP40011183-CH6-SW1> You can implement this yourself for an existing SQLite version using this call: <http://www.sqlite.org/c3ref/temp_directory.html> but it may be possible to build this behaviour into SQLite so if you do not call that function SQLite still automatically does The Right Thing under iOS and OS X. That's something for the SQLite development team to pick over. An alternative to what's written above is to create a convention that all SQLite-using sandboxed apps will share joint rights to an "App group container directory", which would be used for all SQLite temporary files. This is done by specifying the app group and its directory in the settings for the sandboxed apps and the SQLite team would have to develop a standard for that, probably as a short page on the SQLite web server with a few lines of code and screenshots on it. Some of what's needed is described here: <http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html> For those of you not familiar with Mac OS X having trouble understanding this /you are not stupid/. These things are fiddly and annoying aspects of OS X and are described only in terms of other OS X terms. Even experienced Mac users hate them. So if you read that document and don't understand it, it just means you're not a genius. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users