On 09 Oct 2011 at 02:02, Simon Slavin <slav...@bigfraud.org> wrote: 

> On 9 Oct 2011, at 1:39am, Tim Streater wrote:
>
>> On 08 Oct 2011 at 23:32, Simon Slavin <slav...@bigfraud.org> wrote:
>>
>>> I'm not clear whether you're using the PDO or the sqlite3 extension to PHP.
>>
>> By the way, is one to be preferred over the other?
>
> That is a great question, and I'd love to see answers from PHP programmers.
>
> My contribution: the thing the PDO API has going for it is that it makes
> changing from one SQL engine to another simple.  If you develop on a
> stand-alone computer for a big multi-server network, this is an advantage.

That won't apply in my case.

> On the other hand, the biggest advantage of using the SQLite3 API is that it's
> such a thin wrapper around the SQLite C API.  For someone who already knows
> SQLite it's very easy to pick up.  But that's only an advantage for
> experienced SQLite users, or those who want to be.

Having it be a thin wrapper suits me.

> I have had trouble using the PDO API in situations that demand proper
> error-handling.  If you have a situation where something either works or
> doesn't you're fine.  If you have to understand exactly what error you got, in
> order to handle several different situations, you pretty-much have to simulate
> all your error conditions and see what happens to write your program.  The
> advantage of the SQLite3 interface here is that it perfectly reflects the
> documentation for the SQLite3 C API, so you can probably figure out what to do
> just by reading the SQLite C documentation.

At present, I'm using PDO and setting it to throw exceptions. So I have a 
try/catch around all my $dbh->query and in there, log what happened and where, 
report to the user and then give up. I haven't looked closely at the SQLite3 
interface in PHP but it wasn't obvious whether I can use the same exception 
mechanism or not. I'll have to see how to incorporate this in my app but for 
now I'm giving up on multiple statements in one call to the interface.

--
Cheers  --  Tim
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to