Posts Tagged “SQL”

…or annoyances with the DSPAM hash driver

I’ve been running DSPAM for a long time and the spam classification is great, unfortunately the maintenance tools are not as it turns out. This is the tale of why and more especially HOW I moved from the hash driver to the mysql driver as a backend for my DSPAM installation.

Read the rest of this entry »

Comments Comments Off

This is an extensible object oriented wrapper around the MySQL and MSSQL (Microsoft SQL Server) interfaces provided by PHP. I’ve been using them for a while, it’s nothing new and no rocket science but others might find them useful.

Why do this at all? why just not stick with the API provided by PHP? It’s really nothing else than a more convenient way to interact with a SQL server and exposing it’s interface in a vendor natural way. Instead of writing mysql_query everywhere, one simply writes query.

Having a consistent interface will obviously help if you are using multiple types of database servers or someday would like to migrate to another SQL server (of course, weird and vendor specific SQL code could be a problem in this case). Other advantages are things like automatic disconnection on object destruction etc.

The foundation is an abstract class called SQLConnector and provides the basic interface. The class will connect to the database on creation and disconnect when the object is destroyed, it also implements __sleep and __wakeup so that it’s possible to serialize a SQL connection.

Because SQLConnector is abstract one can’t create objects directly from it, we’ll create child classes for each type of SQL-server we want to connect to. These objects will share the same interface and can be used interchangeably.
Read the rest of this entry »

Comments 1 Comment »