Summary

Because the underlying database abstraction layer is the very flexible and quite powerful PEAR DB package, the Database class is one you'll be able to use in nearly every project on which you work. Although not every query you write will be portable across different database backends, the ability to quickly change the database type makes it much easier to reuse data-driven components across different projects.

In Chapter 11, you'll build a robust logging and debugging system that will plug into the Database class and provide a means for debugging database problems without printing query details to the screen. Because every query in your applications will go through the Database class, you'll have a centralized location to capture the queries and add them to logs or debug output.

Use the Singleton design pattern when you want to ensure that there is no more than one instance of a class. Any time the instantiation of a class has a large overhead, such as establishing a connection to a database, and when it is possible to limit users of that class to only one instance, this technique can reduce system load and improve overall application performance.



Professional PHP5 (Programmer to Programmer Series)
Professional PHP5 (Programmer to Programmer Series)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 182

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net