SQLite uses CreateFile2 in a Windows store aka UWP application
https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422(v=vs.85).aspx
When called from a Windows Store app, CreateFile2 is simplified. You can open
only files or directories inside the ApplicationData.LocalFolder or
Package.InstalledLocation directories.
It can't open files in other locations, such as removable media.
This is an interesting request, but it's really a limitation of Windows. UWP
apps using SQLite can't access databases on removable media until CreateFile2
changes (or an alternative is provided).
- Howard
This email may contain confidential and privileged information.? Any
unauthorized use is prohibited.? If you are not the intended recipient, please
contact the? sender by reply email and destroy all copies of the original
message.
-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of
[email protected]
Sent: Sunday, June 28, 2015 9:00 AM
To: sqlite-users at mailinglists.sqlite.org
Subject: sqlite-users Digest, Vol 90, Issue 27
Send sqlite-users mailing list submissions to
sqlite-users at mailinglists.sqlite.org
To subscribe or unsubscribe via the World Wide Web, visit
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
or, via email, send a message with subject or body 'help' to
sqlite-users-request at mailinglists.sqlite.org
You can reach the person managing the list at
sqlite-users-owner at mailinglists.sqlite.org
When replying, please edit your Subject line so it is more specific than "Re:
Contents of sqlite-users digest..."
Today's Topics:
1. RemovableStorage in UWP for SQLite database - sqlite3_open_v2
issue (Juan Pablo Garc?a Coello)
2. Re: RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue (Scott Doctor)
3. Re: RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue (Juan Pablo Garc?a Coello)
----------------------------------------------------------------------
Message: 1
Date: Sat, 27 Jun 2015 16:37:19 +0000
From: Juan Pablo Garc?a Coello <[email protected]>
To: "sqlite-users at mailinglists.sqlite.org"
<sqlite-users at mailinglists.sqlite.org>
Subject: [sqlite] RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue
Message-ID:
<414DD1207A7EA3409BAA064DBD728BE038A8A46F at
ORD2MBX05C.mex05.mlsrvr.com>
Content-Type: text/plain; charset="gb2312"
I have tested a SQLite database with the typical, working like a charm:
Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"db.dat");
I wanted to create the database in an external storage, to do that I need to
add the following steps:
1.- Add Capability to use removablestorage.
2.- Add file type association in order to have rights to manage that kind of
files
(The details here:
http://expediteapps.com/blog/data-logger-with-windows-10-iot-in-progress/)
So then I change the path to the removable storage path like ?E:\db.dat? and it
always tells CannotOpen.
(I can work with text .dat files without issues.)
The SQLite library PCL It arrives to here:
SQLiteApiWinRT.cs
public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs)
{
Sqlite3DatabaseHandle internalDbHandle;
var ret = (Result)SQLite3.Open(filename, out
internalDbHandle, flags, zvfs);
db = new DbHandle(internalDbHandle);
return ret;
}
Where Open is
[DllImport("sqlite3", EntryPoint = "sqlite3_open_v2", CallingConvention =
CallingConvention.Cdecl)] public static extern Result Open(byte[] filename, out
IntPtr db, int flags, IntPtr zvfs);
where I am using:
SQLite.UAP.2015, Version=3.8.10
And here is where the road ends, any help? I do not know in where the string is
converter to storagefile or whatever way is accessing to the file, any clues?
NOTE: I have used ??????? ??????? Libraries too, arriving to the same point, so
I can assure that is internal, but I do not know how to continue.
Thank you!
Juan Pablo Garcia Coello
Co-Founder & CTO
www.expediteapps.com
www.expediteapps.com/blog
------------------------------
Message: 2
Date: Sat, 27 Jun 2015 10:10:56 -0700
From: Scott Doctor <[email protected]>
To: General Discussion of SQLite Database
<sqlite-users at mailinglists.sqlite.org>
Subject: Re: [sqlite] RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue
Message-ID: <558ED920.4020502 at scottdoctor.com>
Content-Type: text/plain; charset=gbk; format=flowed
On 6/27/2015 9:37 AM, Juan Pablo Garc?a Coello wrote:
> path to the removable storage path like ??E:\db.dat?? and it always tells
> CannotOpen.
Your email is using
charse gb2312
which is a Chinese character set.
four of the characters are not mapping to UTF-8 properly.
A problem may be that you are passing invalid UTF-8 to SQLite which may be
causing the inability to open the file.
the invalid characters are 0x3f ox3f which is not a valid UTF-8 sequence.
------------
Scott Doctor
scott at scottdoctor.com
------------------
------------------------------
Message: 3
Date: Sat, 27 Jun 2015 17:27:04 +0000
From: Juan Pablo Garc?a Coello <[email protected]>
To: General Discussion of SQLite Database
<sqlite-users at mailinglists.sqlite.org>
Subject: Re: [sqlite] RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue
Message-ID:
<414DD1207A7EA3409BAA064DBD728BE038A8A4A1 at
ORD2MBX05C.mex05.mlsrvr.com>
Content-Type: text/plain; charset="iso-8859-1"
Sorry that where the Spanish quotation it is just E:\db.dat. if there is any
strange char it is about the email not the code.
I can assure that is not just a newbie issue, it is more complex I think it has
to be something with permissions or how internally looks for the file.
-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org
[mailto:[email protected]] On Behalf Of Scott Doctor
Sent: 27 June 2015 18:11
To: General Discussion of SQLite Database
Subject: Re: [sqlite] RemovableStorage in UWP for SQLite database -
sqlite3_open_v2 issue
On 6/27/2015 9:37 AM, Juan Pablo Garc?a Coello wrote:
> path to the removable storage path like ??E:\db.dat?? and it always tells
> CannotOpen.
Your email is using
charse gb2312
which is a Chinese character set.
four of the characters are not mapping to UTF-8 properly.
A problem may be that you are passing invalid UTF-8 to SQLite which may be
causing the inability to open the file.
the invalid characters are 0x3f ox3f which is not a valid UTF-8 sequence.
------------
Scott Doctor
scott at scottdoctor.com
------------------
------------------------------
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
End of sqlite-users Digest, Vol 90, Issue 27
********************************************