PHP Classes

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    
Ratings Unique User Downloads Download Rankings
StarStarStar 47%Total: 1,535 All time: 2,548 This week: 200Up
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
Age: ???
All time rank: 18165 in Malaysia Malaysia
Week rank: 438 Up2 in Malaysia Malaysia Up

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,535
This week:0
All time:2,548
This week:200Up
User Ratings User Comments (1)
 All time
Utility:70%StarStarStarStar
Consistency:60%StarStarStarStar
Documentation:60%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:47%StarStarStar
Rank:2620
 
Excellent
14 years ago (kishore kumar)
70%StarStarStarStar