PHP Classes
elePHPant
Icontem

DatabaseAccess: Abstract db queries from the ADOdb library.

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2003-03-12 (13 years ago) RSS 2.0 feedStarStarStar 47%Total: 1,532 All time: 2,479 This week: 890Up
Version License Categories
databaseaccess 1.0BSD LicenseDatabases
Description Author

This class abstracts database queries (UPDATE, SELECT, INSERT, REPLACE, DELETE) by passing data to class methods, the query will be generated and run automatically.

This class is meant to be used in conjunction with the ADOdb database library.

Picture of Ditesh Kumar
Name: Ditesh Kumar <contact>
Classes: 1 package by
Country: Malaysia Malaysia

Details
Hi,

First of all, this class is meant to be used with the excellent ADOdb database library (available at: http://php.weblogs.com/ADOdb). Secondly, the version of ADOdb I'm using is abit dated (version 2.80) so if you have problems please do tell me.

NOTE: This class uses a lot of code from the ADOdb manual as well as other various sources. Since John Lim licensed ADOdb under BSD, I do too to ensure less licensing conflicts.

--- Introduction

This class abstracts SQL queries so that the query does not have to be written. It will be generated automatically based on the data structures passed to the functions. For example, instead of writing 

"SELECT * FROM someTable, anotherTable", you would do this: 

$dbObject->select(array("someTable", "anotherTable"));

The purpose of this class is to allow logical construction of SQL queries. I think of SQL queries in terms of tables used and columns needed and relationships used. Hence, the class methods have been designed in that manner: specify the tables, columns needed and relationships used.

--- Using this class

Read the class source code. I've documented it well. It's easy to follow. This is a very rough guide.

1) Include the class in your php file.
2) define() ADODB_INCLUDE_ROOT to point to your ADOdb directory, eg:

	define(ADODB_INCLUDE_ROOT, "/some/path/to/adodb");

3) Instantiate the class, eg:

	$dbAccess = new DatabaseAccess();

4) Use it! You have the methods:

a) execute() - which executes a raw SQL query.
b) select() - which executes a SELECT SQL query.
c) update() - which executes an UPDATE SQL query.
d) delete() - which executes a DELETE SQL query.
e) replace() - which executes a REPLACE SQL query.
f) insert() - which execute an INSERT SQL query.

Read the class documentation (within the source code) for more details on how to call the methods. It's really quite easy.

If you need more help, please email ditesh@tm.net.my or saradiya@ameba6.com.

Cheers,
The Walrus and The Potato
  Files folder image Files  
File Role Description
Plain text file class.DatabaseAccess.inc.php Class Class file.
Accessible without login Plain text file README Doc. README

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,532
This week:0
All time:2,479
This week:890Up
User Ratings User Comments (1)
 All time
Utility:70%StarStarStarStar
Consistency:60%StarStarStarStar
Documentation:60%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:47%StarStarStar
Rank:2294
 
Excellent
7 years ago (kishore kumar)
70%StarStarStarStar