Location: PHPKode > scripts > Data Objects > documentation.txt
 * dataObject
 * Base definition of the data Object
 * @package 
 * @author Ivan CampaƱa <hide@address.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


$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



$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


$dataObject->store( )
Sends the changes to the DB, inserting new data or updating the existing data.

Erasing data from the DB



Deletes the currently selected register, based on the data returned by the load function.

Setting and Returning values

$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.

Return current item: Data Objects