PHP
  Home arrow PHP arrow Completing the MySQL Class with Method Chaining
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? 
Google.com  
PHP

Completing the MySQL Class with Method Chaining
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2009-11-09


    Table of Contents:
  • Completing the MySQL Class with Method Chaining
  • Review: creating ORDER BY SQL clauses with chainable methods
  • Dynamically creating the LIKE part of a query
  • Adding a chainable factory method to the MySQL class

  • 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


    Completing the MySQL Class with Method Chaining
    ( Page 1 of 4 )

    Among the numerous features provided by PHP 5, there’s one that many developers find appealing. It permits the building of compact and modular programming interfaces. Yes, as you may have guessed, in this specific case I’m talking about method chaining, a programming approach can be easily mastered by those with an average background in the object-oriented paradigm. This is the sixth part of a 12-part series on method chaining.

    Indeed, learning how to create chainable methods in PHP 5 class is a pretty straightforward process that will make your own classes more compact and modular as well. Therefore, I suggest you read this series of articles; in it, you'll find an approachable guide that will show you the basics of using method chaining and how to implement this approach for developing real-world programs.

    And now that you're aware of the main goal of this series, it's time to review the topics that were discussed in the last article, as a quick reminder. In that installment I showed how to add a simple chainable method to the MySQL abstraction class previously developed. It was used for creating the "ORDER BY" part of a SELECT statement.

    Defining a method like this allowed us to retrieve database records by using only a few lines of compact code. Now I'd like to finish building this sample MySQL abstraction class by adding to it two final chainable methods. The first one will be charged with building the "LIKE" clause of SELECT queries, while the second method will be a factory responsible for returning to client code only singletons of this class.

    Want to see how these two useful methods will be defined? Then click on the link that appears below and keep reading.



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

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek