[PHP5-FPM] Sqlite3 or pdo_sqlite?

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

[PHP5-FPM] Sqlite3 or pdo_sqlite?

Gilles Ganault-3
Hello

I'm using the pre-compiled PHP5-FPM/FastCGI (www.php-fpm.org) which
seem to contain the following DB connectors:

PDO drivers mysql, sqlite, sqlite2
pdo_mysql 5.1.48
pdo_sqlite 3.6.22

SQLite 2.8.17
sqlite3 3.6.22

So from the above, it looks like this binary supports access to
MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
modes.

If that's correct, and provided the application doesn't need to be
DB-agnostic... why should I choose PDO instead of the procedural
functions to SQLite3?

Thank you.

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

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

Simon Slavin-3

On 24 Jul 2010, at 9:56am, Gilles Ganault wrote:

> So from the above, it looks like this binary supports access to
> MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
> modes.
>
> If that's correct, and provided the application doesn't need to be
> DB-agnostic... why should I choose PDO instead of the procedural
> functions to SQLite3?

The main advantage of the PDO is that the calls for each SQL engine are identical.  In other words, you can write your code as if you're going to use SQLite, then one day find you have to move to MySQL, and you'll only have to change one line of code -- the one that says which engine you want it to use.  If you're in a profession where you have to use many SQL engines this can save you from having to learn the different rules and foibles of each one.

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

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

J. King-3
On Sat, 24 Jul 2010 08:33:21 -0400, Simon Slavin <[hidden email]>  
wrote:

>
> On 24 Jul 2010, at 9:56am, Gilles Ganault wrote:
>
>> So from the above, it looks like this binary supports access to
>> MySQL(i) and SQLite2/3, in both procedural and (PDO) object-oriented
>> modes.
>>
>> If that's correct, and provided the application doesn't need to be
>> DB-agnostic... why should I choose PDO instead of the procedural
>> functions to SQLite3?
>
> The main advantage of the PDO is that the calls for each SQL engine are  
> identical.  In other words, you can write your code as if you're going  
> to use SQLite, then one day find you have to move to MySQL, and you'll  
> only have to change one line of code -- the one that says which engine  
> you want it to use.  If you're in a profession where you have to use  
> many SQL engines this can save you from having to learn the different  
> rules and foibles of each one.

This is mostly fantasy, as SQL engines have widely diverging language  
dialects; the API is a relatively small component of interoperability  
pain.  Still, it is a concern, and certainly a slight advantage to PDO.

PDO_sqlite3 also does have the advantage of being available by default  
since PHP 5.0.0, whereas sqlite3 is only available by default since PHP  
5.3.0.  I'm aware of no other advantages to using PDO, and from what I've  
read it's on the slow side.

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

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

Alan Chandler
On 24/07/10 14:18, J. King wrote:

> PDO_sqlite3 also does have the advantage of being available by default
> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP
> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've
> read it's on the slow side.
>

Right now its the only php library that calls (or enables a call) to
sqlite_busy_timeout.

There is a patch which will make it into php 5.3.3 when it is released
"very shortly" that does provide for that call.

This makes the sqlite3 pretty bad for applications (such as the typical
web site) where there might be some locking issues.


--
Alan Chandler
http://www.chandlerfamily.org.uk

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

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

Alan Chandler
On 24/07/10 15:41, Alan Chandler wrote:

> On 24/07/10 14:18, J. King wrote:
>
>> PDO_sqlite3 also does have the advantage of being available by default
>> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP
>> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've
>> read it's on the slow side.
>>
>
> Right now its the only php library that calls (or enables a call) to
> sqlite_busy_timeout.
>
> There is a patch which will make it into php 5.3.3 when it is released
> "very shortly" that does provide for that call.
>
> This makes the sqlite3 pretty bad for applications (such as the typical
> web site) where there might be some locking issues.
>
>
I meant that right now PDO:: is the only library that enables the call.
  Sqlite3 will get it shortly

--
Alan Chandler
http://www.chandlerfamily.org.uk

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

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

Kees Nuyt
In reply to this post by J. King-3
On Sat, 24 Jul 2010 09:18:57 -0400, "J. King"
<[hidden email]> wrote:


> PDO_sqlite3 also does have the advantage of being available by default  
> since PHP 5.0.0, whereas sqlite3 is only available by default since PHP  
> 5.3.0.  I'm aware of no other advantages to using PDO, and from what I've  
> read it's on the slow side.

There's also pdo_sqlite_external which uses the sqlite3.dll
the user provides, so you can use the latest and greatest
sqlite version without having to wait for incorporation in
PHP or PDO itself.

Possible limitation: I was told pdo_sqlite_external is only
available for MS Windows.
--
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [PHP5-FPM] Sqlite3 or pdo_sqlite?

Gilles Ganault-3
On Sat, 24 Jul 2010 18:50:05 +0200, Kees Nuyt
<[hidden email]> wrote:
>There's also pdo_sqlite_external which uses the sqlite3.dll
>the user provides, so you can use the latest and greatest
>sqlite version without having to wait for incorporation in
>PHP or PDO itself.

Thanks guys for the input. I'll check when sqlite_busy_timeout() is
added to the SQLite3 in PHP5, and use PDO if it doesn't come out soon
enough.

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