Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Creating a PostgreSQL and MySQL driver

By Tony Marston
2005-09-20


Introduction

The software that I write is not intended for just one customer who is locked into a single RDBMS. Instead it can be used by virtually any customer using the RDBMS of their choice. How is this possible? I deliberately designed and built my infrastructure around the 3 Tier Architecture which breaks down application code into three distinct areas of responsibility:

  • Presentation logic = User Interface, displaying data to the user, accepting input from the user.
  • Business logic = Business Rules, handles data validation and task-specific behaviour.
  • Data Access logic = Database Communication, constructing SQL queries and executing them via the relevant API.

It is only the Data Access layer which communicates with the database, therefore it should be possible to communicate with another database simply by changing the component which exists within this layer. I have already produced two versions of my Data Access Object for MySQL:

  • One for versions up to 4.0 which uses the original mysql_* functions.
  • Another for version 4.1 and above which uses the 'improved' mysqli_* functions.

The purpose of this article is to document my experiences while producing a DAO for a totally different RDBMS, in this case for PostgreSQL (version 8.0.3).



Tutorial Pages:
» Introduction
» Administrative programs
» Connecting to a Database
» CREATE TABLE syntax
» SQL queries
» Conclusion


 | Bookmark
Related Tutorials:
» Installing MySQL on Windows
» Implementing High Availability in MySQL
» Stored Procedures are EVIL
» MySQL Database Handling in PHP
» A Flexible Method of Storing Control Data
» Exploring MySQL CURDATE and NOW. The Same But Different.