Extending SQLiteDatabase

One of the nice things about object-oriented programming (OOP) is exception handling. Procedural error trapping is not only tedious, it clutters up your code and can make it unreadable. Taking an OO approach and using exception handling sounds like the ideal solution—until you realize that the database constructor is the only method of all the SQLite classes that throws an exception. If you want to check for errors when creating result sets, you are stuck using procedural code. It looks like we're right back where we started.

We'll next discuss how this can be fixed.

Get Object-Oriented PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.