Usage of temporary files of SQLite3 on Android / SQLite commands fail

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Usage of temporary files of SQLite3 on Android / SQLite commands fail

mailing lists
Hi,

what is your experience with temporary files requested by SQLite3 on Android? I am using SQLite3 natively on Android - I compiled SQLite3 by myself - and get an error when SQLite3 tries to create temporary files because:

- the directories
        /var/tmp
        /usr/tmp
        /tmp
        .
  are not accessible by a standard user (and therefore the app);
- getenv is not guaranteed to be supported (or?);
- sqlite3_temp_directory should not be used because it is deprecated.

What are you doing?

Regards,
Hartwig

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

J Decker
On Sat, Jun 9, 2018 at 10:00 AM skywind mailing lists <
[hidden email]> wrote:

> Hi,
>
> what is your experience with temporary files requested by SQLite3 on
> Android? I am using SQLite3 natively on Android - I compiled SQLite3 by
> myself - and get an error when SQLite3 tries to create temporary files
> because:
>
> - the directories
>         /var/tmp
>         /usr/tmp
>         /tmp
>         .
>
Do you really NEED it to be a file or could you just open it as :memory: ?


>   are not accessible by a standard user (and therefore the app);
> - getenv is not guaranteed to be supported (or?);
> - sqlite3_temp_directory should not be used because it is deprecated.
>
> What are you doing?
>
> Regards,
> Hartwig
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

J. King-3
On June 9, 2018 1:08:07 PM EDT, J Decker <[hidden email]> wrote:

>On Sat, Jun 9, 2018 at 10:00 AM skywind mailing lists <
>[hidden email]> wrote:
>
>> Hi,
>>
>> what is your experience with temporary files requested by SQLite3 on
>> Android? I am using SQLite3 natively on Android - I compiled SQLite3
>by
>> myself - and get an error when SQLite3 tries to create temporary
>files
>> because:
>>
>> - the directories
>>         /var/tmp
>>         /usr/tmp
>>         /tmp
>>         .
>>
>Do you really NEED it to be a file or could you just open it as
>:memory: ?
>
>
>>   are not accessible by a standard user (and therefore the app);
>> - getenv is not guaranteed to be supported (or?);
>> - sqlite3_temp_directory should not be used because it is deprecated.
>>
>> What are you doing?
>>
>> Regards,
>> Hartwig
>>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

SQLite also creates temp files in various circumstances:

<https://sqlite.org/tempfiles.html>

This is definitely a valid question, though not one for which I have an answer.
--
J. King
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

Dan Kennedy-4
In reply to this post by mailing lists
On 06/10/2018 12:00 AM, skywind mailing lists wrote:

> Hi,
>
> what is your experience with temporary files requested by SQLite3 on Android? I am using SQLite3 natively on Android - I compiled SQLite3 by myself - and get an error when SQLite3 tries to create temporary files because:
>
> - the directories
> /var/tmp
> /usr/tmp
> /tmp
> .
>    are not accessible by a standard user (and therefore the app);
> - getenv is not guaranteed to be supported (or?);
> - sqlite3_temp_directory should not be used because it is deprecated.
>
> What are you doing?

People usually end up building with:

    -DSQLITE_TEMP_STORE=3

This causes SQLite to use main memory for all temp files.

Dan.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

mailing lists
Hi,

currently I am not creating large subqueries or views and therefore storing the temporary data in memory is a solution but I would like to have a future proof solution. And I do not like to think about it anymore in the future.

Or can we stop deprecating sqlite3_temp_directory? Why was it at all deprecated? It seems to be (according to the comments) that there has been some trouble with assigning and releasing the variable but this can be overcome by not exposing it publicly and using an appropriate function instead.

Regards,
Hartwig

> Am 2018-06-09 um 19:16 schrieb Dan Kennedy <[hidden email]>:
>
> On 06/10/2018 12:00 AM, skywind mailing lists wrote:
>> Hi,
>>
>> what is your experience with temporary files requested by SQLite3 on Android? I am using SQLite3 natively on Android - I compiled SQLite3 by myself - and get an error when SQLite3 tries to create temporary files because:
>>
>> - the directories
>> /var/tmp
>> /usr/tmp
>> /tmp
>> .
>>   are not accessible by a standard user (and therefore the app);
>> - getenv is not guaranteed to be supported (or?);
>> - sqlite3_temp_directory should not be used because it is deprecated.
>>
>> What are you doing?
>
> People usually end up building with:
>
>   -DSQLITE_TEMP_STORE=3
>
> This causes SQLite to use main memory for all temp files.
>
> Dan.
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

Bob Friesenhahn
On Sat, 9 Jun 2018, skywind mailing lists wrote:

> Hi,
>
> currently I am not creating large subqueries or views and therefore storing the temporary data in memory is a solution but I would like to have a future proof solution. And I do not like to think about it anymore in the future.

Have you tried setting the POSIX standard TMPDIR environment variable?
This might have useful influence under Android.

Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

Simon Slavin-3
On 10 Jun 2018, at 1:30am, Bob Friesenhahn <[hidden email]> wrote:

> On Sat, 9 Jun 2018, skywind mailing lists wrote:
>
>> storing the temporary data in memory is a solution but I would like to have a future proof solution. And I do not like to think about it anymore in the future.
>
> Have you tried setting the POSIX standard TMPDIR environment variable? This might have useful influence under Android.

I am surprised that this problem has not been solved.  There are at least two well-known SQLite libraries for Android.  Do they include a setting indicating a directory which an Android App is able to use ?

Sorry I can't solve the problem myself.  I have nothing that runs Android.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

mailing lists
In reply to this post by Bob Friesenhahn
Hi,

but to which directory should I set it? There is no general tmp directory accessible.

Regards,
Hartwig

> Am 2018-06-10 um 02:30 schrieb Bob Friesenhahn <[hidden email]>:
>
> On Sat, 9 Jun 2018, skywind mailing lists wrote:
>
>> Hi,
>>
>> currently I am not creating large subqueries or views and therefore storing the temporary data in memory is a solution but I would like to have a future proof solution. And I do not like to think about it anymore in the future.
>
> Have you tried setting the POSIX standard TMPDIR environment variable? This might have useful influence under Android.
>
> Bob
> --
> Bob Friesenhahn
> [hidden email], http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

Thomas Kurz
I suggest using a tmp directory within in your private app directory.

----- Original Message -----
From: skywind mailing lists <[hidden email]>
To: SQLite mailing list <[hidden email]>
Sent: Sunday, June 10, 2018, 18:44:45
Subject: [sqlite] Usage of temporary files of SQLite3 on Android / SQLite commands fail

Hi,

but to which directory should I set it? There is no general tmp directory accessible.

Regards,
Hartwig

> Am 2018-06-10 um 02:30 schrieb Bob Friesenhahn <[hidden email]>:

> On Sat, 9 Jun 2018, skywind mailing lists wrote:

>> Hi,

>> currently I am not creating large subqueries or views and therefore storing the temporary data in memory is a solution but I would like to have a future proof solution. And I do not like to think about it anymore in the future.

> Have you tried setting the POSIX standard TMPDIR environment variable? This might have useful influence under Android.

> Bob
> --
> Bob Friesenhahn
> [hidden email], http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage of temporary files of SQLite3 on Android / SQLite commands fail

Kevin Benson
In reply to this post by mailing lists
On Sun, Jun 10, 2018 at 12:45 PM skywind mailing lists <
[hidden email]> wrote:

> Hi,
>
> but to which directory should I set it? There is no general tmp directory
> accessible.
>
> Regards,
> Hartwig
>
> > Am 2018-06-10 um 02:30 schrieb Bob Friesenhahn <
> [hidden email]>:
> >
> > On Sat, 9 Jun 2018, skywind mailing lists wrote:
> >
> >> Hi,
> >>
> >> currently I am not creating large subqueries or views and therefore
> storing the temporary data in memory is a solution but I would like to have
> a future proof solution. And I do not like to think about it anymore in the
> future.
> >
> > Have you tried setting the POSIX standard TMPDIR environment variable?
> This might have useful influence under Android.
> >
> > Bob
>
>
Android is foreign to me, but the thread below mentions: /data/local/tmp

https://stackoverflow.com/a/41105574/1828624
--
   --
      --
         --Ö¿Ö--
        K e V i N
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users