First steps with PDO in PHP 5.1

February 5th, 2006

Environment: Windows, CLI, using pdo_odbc.

Here are some observations from my first steps with the new PDO extension.

Good:

  • Exception-Safe (with PDO::ERRMODE_EXCEPTION)
    I wonder how one could every seriously write good application without exceptions (i.e. proper and predictable error handling)
  • Simple, easy API
    The API is so easy, it has so less methods and therefore is easy to grasp. It may all back in complex situations but that I cannot tell that at the moment.

Not so good:

  • Bound parameters/values not working as expected
    I’m not yet sure if it’s because I use pdo_odb or something else. What I tried, I couldn’t get it to working, no matter which way I tried. So I had to revert to using variables direct in the SQL statement.
  • Crashes
    PDO has the bad habit that it crashes PHP where it can. Since I’m under Windows and I’ve no Windows C IDE I can’t help in debugging this problems myself but can only try to come up with reproduceable scripts. PDO seems to completely go havoc when you use the PDO::FETCH_LAZY attribute on PDO::query(). With havoc I mean that it throws back to you errors which aren’t a direct result of using FETCH_LAZY. I observed that I got two different kind of exceptions (Yes, I do love them) when using FETCH_LAZY. Both were Microsoft Access Driver problems, but they didn’t showed up once I stopped using FETCH_LAZY. One problem was error code 1311 and the other 1310. The former has something to do with running out of memory and the second one with an invalid table id.Then it seems, unreproduceable in small scripts, that it crashes when doing clean up at the end of the script. So basically, you’re doing your thing and when the script ends it gives you the send report to microsoft dialog

Entry Filed under: Coding,PHP

Leave a Comment

hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

February 2006
M T W T F S S
« Dec   May »
 12345
6789101112
13141516171819
20212223242526
2728  

Most Recent Posts