/**
* dataObject
*
* Base definition of the data Object
*
* @package
* @author Ivan Campaña <ivan.campana@gmail.com>
* @copyright Copyright (c) 2005 - GNU/GPL License
* @version 0.1
* @access public
**/
This is far from complete, but at least can be used as a start point to know the basics of the object
Creating an new Object
========================
Sample:
$variable = new dataObject( $connection, $tablename);
$connection .- is a valid ADODB connection to any Database, to be able to use the metadata functions of the DB by the time of this release mysql, odbc (including db2, odbc_mssql, etc), mssql, postgres, interbase/firebird, oci8 are currently supported.
$tablename .- is a string indicating the name of the table we want to work with.
Loading data from the DB
========================
Sample:
$dataObject->load($PKs)
$PKs.- it can be a single value or an array of values indicating the id of the register we want to load, based on this the object determines if it is a new register or an existing one.
Saving data in the DB
========================
Sample:
$dataObject->store( )
Sends the changes to the DB, inserting new data or updating the existing data.
Erasing data from the DB
========================
Sample:
$dataObject->delete()
Deletes the currently selected register, based on the data returned by the load function.
Setting and Returning values
========================
Sample:
$dataObject->set( $field_name, $value)
$result = $dataObject->get($field_name)
To set data values, just call the set method indicating the name of the field that you wish to update and the new value.
To get the currently stored value use the get method by just passing the field name as parameter.
|