PHP
  Home arrow PHP arrow Building Object-Oriented Database Interfaces in PHP: Abstracting Database Tables
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Building Object-Oriented Database Interfaces in PHP: Abstracting Database Tables
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 12
    2005-08-17


    Table of Contents:
  • Building Object-Oriented Database Interfaces in PHP: Abstracting Database Tables
  • Turning back time: a quick look at the older "DBIGenerator" class
  • Working with multiple database interfaces: improving the "DBIGenerator" class
  • Getting closer: a detailed look at the "generate()' method
  • Updating and deleting a row: the "update()" and "delete()" methods
  • Spotting the differences: the new "DBIGenerator" class in practice

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building Object-Oriented Database Interfaces in PHP: Abstracting Database Tables
    ( Page 1 of 6 )

    Welcome to part two of the series "Building Object-Oriented Database Interfaces in PHP." In the previous article, I offered complete coverage of the role that database interfaces play in Web applications, highlighting the immediate benefits of having a centralized mechanism for accessing, processing and verifying data, within an object-oriented environment. The "DBIGenerator" class I showed for demonstration purposes in the first article doesn't scale well in real applications. In this article, we will start solving its problems with a revamped version of the class.

    Introduction

    Without having to necessarily mess up things with some concepts inherent to theory, we might generally conceive database interfaces as a logical representation coded within a class of a database table, where each table field is represented as a class data member. By following this generic rule on a given database table, we're able to build programmatically a class that contains all of the core DML statements required to manipulate table rows, using the methods provided by the class, in this way acting as single access points to the table data.

    Stepping back to the first article, I've shown a "DBIGenerator" class that quickly creates DB interface classes, spawning the corresponding objects to provide access to a given database table. As you probably remember, this class doesn't scale well in real applications, since it works with a hard-coded database table and fields, thereby limiting significantly its flexibility and portability.

    In order to solve these relevant issues, this second part will be the starting point for defining a revamped version of the "DBIGenerator" class, which, as we'll see in short order, will be powerful enough to be implemented successfully in the creation of DB interfaces.

    Confronted with this scenario, it's time to put our coding abilities to the test. Let's go!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT