Record Class Reference

List of all members.

Public Member Functions

Public Attributes


Constructor & Destructor Documentation

Record::Record ( &$  ds,  $  addRecord = false )

 

Creates a new Record and sets the parent dataset to the passed in value. The object created with 'new' may be a DataSetException if property $resultSet of the passed in DataSet object is NULL.

If $addRecord is true, then an empty record is created.

Parameters:
DataSet $ds The parent / owning dataset.
boolean $addRecord Whether to create an empty record.


Member Function Documentation

Record::ZOMBIE ()

 

Record::UNKNOWN ()

 

Record::INSERT ()

 

Record::UPDATE ()

 

Record::DELETE ()

 

Record::BEFOREINSERT ()

 

Record::AFTERINSERT ()

 

Record::BEFOREUPDATE ()

 

Record::AFTERUPDATE ()

 

Record::BEFOREDELETE ()

 

Record::AFTERDELETE ()

 

Record::initializeRecord ()

 

Performs initialization for this Record. private

Record::createValues ( &$  rs)

 

Creates the value objects for this Record. It is 1 based

private

Returns void

Record::save ()

 

Saves the data in this Record to the database.

Returns boolean True if the save completed, false otherwise.

SQL- or DataSetException on failure.

Record::doDelete ()

 

Performs a DELETE on databse using this Record as criteria.

private

Returns mixed int Number of rows affected by delete or SQL - or DataSetException.

Record::doUpdate ()

 

Saves the data in this Record to the database with an UPDATE statement.

private

Returns SQL UPDATE statement

Exceptions:
DataSetException,SQLException 

Record::doInsert ()

 

Saves the data in this Record to the database with an INSERT statement

private

Returns mixed int on success, SQL- or DataSetException on failure.

Record::getUpdateSql ()

 

Builds the SQL UPDATE statement for this Record

private

Returns string SQL UPDATE statement on success, SQL- or DataSetException on failure

Record::getDeleteSql ()

 

Builds the SQL DELETE statement for this Record.

private

Returns mixed string SQL DELETE statement on success, SQL- or DataSetException - if no keydef

Record::getInsertSql ()

 

Builds the SQL INSERT statement for this Record

private

Returns string SQL INSERT statement

& Record::getValue ( $  col)

 

Gets the value for specified column. This function performs no type-conversion.

Returns string The value object for specified column as string on success, DataSetException on failure.

Record::columns ()

 

Get the column names for current record.

Returns array Column names.

Record::dirtyColumns ()

 

Get the modified (dirty) columns. Private right now because this is only used internally. No real reason why this couldn't be public, though ...

private

Returns array

Record::size ()

 

The number of columns in this object.

Returns the number of columns in this object

Record::toBeSavedWithInsert ()

 

Whether or not this Record is to be saved with an SQL insert statement

Returns boolean True if saved with insert

Record::toBeSavedWithUpdate ()

 

Whether or not this Record is to be saved with an SQL update statement

Returns boolean True if saved with update

Record::toBeSavedWithDelete ()

 

Whether or not this Record is to be saved with an SQL delete statement

Returns boolean True if saved with delete

Record::markRecordClean ()

 

Marks all the values in this record as clean.

Returns void

Record::markForInsert ()

 

Marks this record to be inserted when a save is executed.

Returns mixed boolean TRUE on success, DataSetException - if DataSet is not TableDataSet

Record::markForUpdate ()

 

Marks this record to be updated when a save is executed.

Returns mixed boolean TRUE on success, DataSetException - if DataSet is not TableDataSet

Record::markToBeDeleted ()

 

Marks this record to be deleted when a save is executed.

Returns mixed boolean TRUE on success, DataSetException - if DataSet is not TableDataSet

Record::unmarkToBeDeleted ()

 

Unmarks a record that has been marked for deletion.

WARNING: You must reset the save type before trying to save this record again.

See also markForUpdate()

markForInsert()

markToBeDeleted()

Returns mixed boolean TRUE on success, DataSetException - if record has already been deleted

Record::markValueClean ( $  col)

 

Marks a value with a given column name as clean (unmodified).

Parameters:
string $col

Returns void

Record::markValueDirty ( $  col)

 

Marks a value with a given column as "dirty" (modified).

Parameters:
string $col

Returns void

Record::setSaveType ( $  type)

 

Sets the internal save type as one of the defined privates (ie: ZOMBIE)

Parameters:
int $type

Returns void

Record::getSaveType ()

 

Gets the internal save type as one of the defined privates (ie: ZOMBIE)

Returns int

& Record::setValue ( $  col,  &$  value )

 

Sets the value of col.

Returns Record this object.

Record::isAZombie ()

 

Determines if this record is a Zombie. A Zombie is a record that has been deleted from the database, but not yet removed from the DataSet.

Returns boolean

Record::needsToBeSaved ()

 

If the record is not clean, needs to be saved with an Update, Delete or Insert, it returns true.

Returns boolean

Record::valueIsClean ( $  column)

 

Determines whether or not a value stored in the record is clean.

Returns mixed boolean TRUE if clean, DataSetException if column is undefined

Record::recordIsClean ()

 

Goes through all the values in the record to determine if it is clean or not.

Returns true if clean

Record::refresh ()

 

This method refreshes this Record's Value's. It can only be performed on a Record that has not been modified and has been created with a TableDataSet and corresponding KeyDef.

Returns mixed boolean TRUE on success, SQL- or DataSetException on failure.

& Record::getRefreshSql ()

 

This builds the SELECT statement in order to refresh the contents of this Record. It depends on a valid KeyDef to exist and it must have been created with a TableDataSet.

Returns string The SELECT SQL on success, DataSetException on failure.

& Record::dataset ()

 

Gets the DataSet for this Record.

Returns DataSet

Record::setParentDataSet ( &$  ds)

 

Sets the parent DataSet for this record.

Parameters:
DataSet $ds

Record::__toString ()

 

This returns a representation of this Record.

Returns string


Member Data Documentation

Record::$values = array()

 

an array of values strings, indexed by column name.

Record::$dirtyCols = array()

 

array of modified (dirty) columns

Record::$ds

 

the parent DataSet for this Record

Record::$saveType = 0

 

this is the state of this record


This file is part of the Creole[php4] library.


Copyright © 2004 Hans Lellelid  
Creole[php4] CVS