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 
iPad news and developer info.
Ads by affinity 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Forums Sitemap 
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 / 3
    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


    Summary: 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.

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

    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

    - MVC and the Zend Framework
    - PHP: Rendering Web Pages Using the Composite...
    - PHP: Creating Dynamic Web Pages with the Com...
    - Secure Encrypting and Decrypting for Your PH...
    - PHP: Creating Single View Objects with the C...
    - PHP: View Object Collections and the Composi...
    - Securing Your PHP Website
    - Determine Link Relevance and Unique Class C ...
    - PHP Composite View Design Pattern: Introduci...
    - Facebook PHP API Applications: A Second Look
    - Secure PHP Programming
    - Facebook PHP API Applications: Basic Introdu...
    - SOAP Servers and Web Services
    - Using XPath, SOAP, and More with Web Services
    - Web Services: SimpleXML


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code



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