PHP Classes

File: README

Recommend this page to a friend!
  Classes of Ditesh Kumar   DatabaseAccess   README   Download  
File: README
Role: Documentation
Content type: text/plain
Description: README
Class: DatabaseAccess
Abstract db queries from the ADOdb library.
Author: By
Last change:
Date: 21 years ago
Size: 1,975 bytes
 

Contents

Class file image Download
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