SQLITE_OPEN_READONLY in PHP

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

SQLITE_OPEN_READONLY in PHP

prog@geniais.com
Hello,

I'm using a C compiled program to write exclusively to a database, and a php script for reading only (that communicates via socket).
I know I can use sqlite3_open_v2() with SQLITE_OPEN_READONLY in C, but there is a way to open a database for readonly in php (since just one C program is used for writing)?
Thank you for help
Ismael

_______________________________________________
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: SQLITE_OPEN_READONLY in PHP

Simon Slavin-3
On 20 Oct 2018, at 5:05pm, [hidden email] wrote:

> I'm using a C compiled program to write exclusively to a database, and a php script for reading only (that communicates via socket).
> I know I can use sqlite3_open_v2() with SQLITE_OPEN_READONLY in C, but there is a way to open a database for readonly in php (since just one C program is used for writing)?

If you need sqlite3 features in PHP then you should to be using the SQLite3 library in PHP rather than the normal database module:

<https://secure.php.net/manual/en/book.sqlite3.php>

If you're using this you can indeed use SQLITE_OPEN_READONLY:

<https://secure.php.net/manual/en/sqlite3.open.php>

If instead you're using the ODBC engine-agnostic library you can also specify readonly, though it is more difficult.  Search this page

<https://secure.php.net/manual/en/function.odbc-connect.php>

for 'read'.

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: SQLITE_OPEN_READONLY in PHP

Tim Streater-3
In reply to this post by prog@geniais.com
On 20 Oct 2018, at 17:05, "[hidden email]" <[hidden email]> wrote:

> I'm using a C compiled program to write exclusively to a database, and a php
> script for reading only (that communicates via socket).
> I know I can use sqlite3_open_v2() with SQLITE_OPEN_READONLY in C, but there
> is a way to open a database for readonly in php (since just one C program is
> used for writing)?

Try:

http://www.php.net/manual/en/sqlite3.open.php

and look at the flags available.


--
Cheers  --  Tim
_______________________________________________
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: SQLITE_OPEN_READONLY in PHP

prog@geniais.com
In reply to this post by prog@geniais.com
Thanks to Simon Slavin and Tim Streater
All replies works fine.
Thank you very much
Ismael

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