System Documentation


/usr/local/php/Database.php

#@
#@ class Recordset
#@
#@
#@	function next(optional type) - return the next record in the recordset or false if there are no more records. 
#@				type can be 'ASSOC','OBJECT','ENUM' which determines the type of object returned. 
#@					ASSOC 	= return associative array with field names as keys.
#@					OBJECT	= return object with field names as properties.
#@					ENUM	= return an enumerated array without field names, the first field is elemant 0, the second is 1, etc.
#@
#@
#@	function read(optional type) - this is an alias for next(type).
#@
#@
#@	function readp(optional type) - returns the previous record in the recordset or false if there isn't a previous record.
#@				type can be 'ASSOC','OBJECT','ENUM' which determines the type of object returned. 
#@					ASSOC 	= return associative array with field names as keys.
#@					OBJECT	= return object with field names as properties.
#@					ENUM	= return an enumerated array without field names, the first field is elemant 0, the second is 1, etc.
#@		
#@
#@	prev prev(optional type) - same as readp(type).
#@		
#@
#@	function free() - call this to explicitly free rescources associated with this recordset. (not realy necessary)
#@
#@
#@	function fieldtypes() - returns an associative array with field names as keys and field types as values. (ie $rs['fieldname']=fieldtype )
#@	
#@
#@	function info() - not implemented yet. currently this will always return true.
#@
#@
#@	function count() = returns the number of records in the recordset.
#@
#@
#@ class Database - database connection.
#@
#@
#@	function Database(optional dbname) - Object contructor, returns new instance of Database.
#@						if dbname is passed a new connection to that database is returned, 
#@						otherwise a connection to the users or sites default database is returned.
#@
#@
#@	function name() - returns the name of the connected database.
#@
#@
#@	function connect() - connect to a different database, returns true if successful, false otherwise.
#@
#@
#@	function query(sql) - send query to database and (if applicable) return resulting recordset.
#@
#@
#@	function val(sql) - send query to database and return the value of the first field of the first record.
#@
#@
#@	function rec(table,optional keyarray) - returns an assosiative array with field names of the passed table as keys. 
#@						if an assosiative array keyarray is passed the retiurned record will be initialized 
#@						with the values from the first record in table matching the values passed in keyaray.
#@
#@	
#@
#@	function write(table,rec) - write record rec to table.
#@	
#@
#@	function delete(table,optional key) - delete record or records from table.
#@				if key is passed matching records are deleted otherwise all records are deleted.
#@
#@
#@ 	function drop(table) - drop the specified table from the database.
#@
#@
#@	function update(table,record,optional key) - update table with record.
#@							if optional key is passed then only matching records are updated,
#@							otherwise all records are updated.
#@
#@
#@	function row(sql) - sends query to database and returns the first resultant row.
#@
#@
#@	function col(sql) - sends query to database and returns an enumerated array containing the values of the first column of the result.
#@
#@
#@	function assoc(sql) - sends query to database and returns an associative array built from the first two columns of the result.
#@				ie $rtn['field1value']=field2value
#@
#@
#@	function typ(table) - return an associative array of field names => field types of the specified table.
#@
#@
#@	function create(table,fields,drop) - create a table. 
#@						fields is an associative array containint fieldname => fieldtype,
#@						if drop is true then the table is droped first if it already exists.
#@
contents