PHP Classes

Base DB: Base class for SQL database access abstraction

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2009-12-24 (5 years ago) RSS 2.0 feedStarStarStarStar 73%Total: 2,284 All time: 1,625 This week: 1,194Up
Version License PHP version Categories  
base_db 57GNU Lesser Genera...5.0Databases
Description Author  

This is a base class for implementing an SQL database access abstraction.

It provides an easy way to deal with databases. it will escape your values by using smart question marks parameters in conditions strings, return most of result in php array instead of resource result set (but you still can access the resource if you really want it) and will assist you in most common databases operation such as establishing database connections, opening a database, quoting a string value, executing a query, retrieving query results as an array, listing the database tables, get the keys of a table, optimizing a table, retrieving the last error that occurred, etc..
It also permit to work on multiple databases and to get unique instances of database connection in a simple way "db::getInstance()"

It also include a class dbProfiler to help you profiling your queries.

Picture of Jonathan Gotti
Name: Jonathan Gotti is available for providing paid consulting. Contact Jonathan Gotti .
Classes: 13 packages by
Country: France France
Age: 39
All time rank: 704 in France France
Week rank: 621 Down23 in France France Down
Innovation award
Innovation award
Nominee: 4x

###---###---###---###--- Welcome to Class-db ---###---###---###---###

#- What is class-db:
Class-db is a php5 base class to create database access wrapper
and to ease programmer work when it's time to work with database.
Class-db comes with some extended class for mysql and sqlite so
you can check thoose out to see how to create your own extended
database wrapper.

#- Author
Jonathan Gotti < jgotti at jgotti dot org >

#- Licence GNU Lesser General Public License

#- History
I've created first version of class-db in 2003 (in fact it was only
class-mysqldb at this time) to assist me dealing with mysql database
common operation. after some change and i finally split it in a two
class: class-db and class-mysqldb in 2006 (there was already a sqlite
wrapper too at this time)
Over the time i added it some stuff as some methods to paginate results
and one of my favourite the smart question marks in conditions strings.
(still in 2006). I also added the possibility to have a single
instance of the same database connection (since 2007) and a new
decorator dbProfiler class to help profiling your application in 2008
and there we are.

#- How to use
you can find some sample of usage in the example file provided with the
library. you may additionnaly find some documentation at

#- contribution, bug report and feedback
Contribution, feedback and bug report are ALWAYS apreciated so don't
hesitate to send me a mail i'll always reply to you.
Also you can leave you bug reports at the online at
but please first check for any previous report at
Contribution to the wiki is appreciated too.

  Files folder image Files  
File Role Description
Accessible without login Plain text file class-db.php Class base abstraction class
Plain text file class-sampledb.php Example example for extended base_db
HTML file classdb.html Doc. Documentation (by Doxygen)
HTML file classsampledb.html Doc. Documentation of an extended db class
Plain text file README Doc. readme file
Plain text file slicesample.php Example easy pagination sample

 Version Control Reuses Unique User Downloads Download Rankings  
 0%2Total:2,284All time:1,625
 This week:0This week:1,194Up
 User Ratings  
 All time