On 22 Feb 2013, at 9:35pm, Didier Morandi <didier.mora...@gmail.com> wrote:

> As far as I understood, SQLite 3 only understands PDO (as I'm
> implementing a program in PHP.) This is why I talked about OOP. I
> thought everyone knew that OOP means Object Oriented Programming and
> PDO is the OOP way of programming with PHP.

There are three ways of handling SQLite databases in PHP.  One of them isn't 
used any more.  The other two are based around OOP ideas because SQLite is 
based around OOP ideas.

One of them is used via PDO and you need to make little changes to your code no 
matter whether you're using SQLite3 or MySQL or some other SQL engine.  The 
advantage of this one is fast switching between using different SQL engines.  
The disadvantage is that some problems are very difficult to diagnose because 
the PDO calls aren't ideally suited to how any one particular SQL engine works.

The other is just a very thin shim which allows you to call the SQLite3 library 
directly from PHP. The advantage of this one is that you can use almost all the 
SQLite3 API and the documentation for SQLite3 is perfectly useful in getting 
your PHP code working, with all errors reported exactly the way the 
documentation says they are.  The disadvantage is that if you switch from 
SQLite3 to another database engine you have to rewrite every database call in 
your code.

But in both cases apart from the actual call which interacts with SQLite, you 
can write the rest of your program procedurally.  So if you don't like OOP 
techniques then apart from the line of your program which invokes a SQLite3 
method you can write the rest of your program completely ignoring OOP ideas.  
In fact many of the examples in the PHP documentation show people doing it that 
way.

So please don't be scared off of using SQLite3 just because it's OOP.  Apart 
from slavishly following that weird arrow syntax for the SQLite calls, you 
don't have to worry about it.  And the PHP documentation includes many examples 
for each call, letting you easily copy stuff without having to understand it 
too well.  In fact that's exactly how I got my own PHP coding done before I 
learned how PHP OOP worked under the covers.

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

Reply via email to