jargon
[ class tree: jargon ] [ index: jargon ] [ all elements ]

Class: Record

Source Location: /jargon/Record.php

Class Overview


A Record represents a row in the database. It contains a hash of values which represent the column values for each row.


Author(s):

Version:

  • $Revision: 1.7 $

Constants

Methods



Class Details

[line 37]
A Record represents a row in the database. It contains a hash of values which represent the column values for each row.



Tags:

version:  $Revision: 1.7 $
author:  Jon S. Stevens <jon@latchkey.com> (Village)
author:  Hans Lellelid <hans@xmpl.org> (Jargon)


[ Top ]


Class Methods


constructor __construct [line 72]

Record __construct( DataSet $ds, [boolean $addRecord = false])

Creates a new Record and sets the parent dataset to the passed in value.

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.

[ Top ]

method columns [line 394]

array columns( )

Get the column names for current record.



Tags:

return:  Column names.
access:  public


[ Top ]

method dataset [line 710]

DataSet dataset( )

Gets the DataSet for this Record.



Tags:

access:  public


[ Top ]

method delete [line 104]

void delete( [Connection $conn = null])

Shortcut method to delete this record.



Tags:

access:  public


Parameters:

Connection   $conn  

[ Top ]

method getRefreshSql [line 662]

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



Tags:

return:  The SELECT SQL
access:  public
throws:  DataSetException


[ Top ]

method getSaveType [line 547]

int getSaveType( )

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



Tags:

access:  public


[ Top ]

method getValue [line 382]

string getValue( mixed $col)

Gets the value for specified column.

This function performs no type-conversion.




Tags:

return:  The value object for specified column as string.
access:  public
throws:  DataSetException


[ Top ]

method isAZombie [line 570]

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



Tags:

access:  public


[ Top ]

method markForInsert [line 460]

void markForInsert( )

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



Tags:

access:  public
throws:  DataSetException - if DataSet is not TableDataSet


[ Top ]

method markForUpdate [line 473]

void markForUpdate( )

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



Tags:

access:  public
throws:  DataSetException - if DataSet is not TableDataSet


[ Top ]

method markRecordClean [line 450]

void markRecordClean( )

Marks all the values in this record as clean.



Tags:

access:  public


[ Top ]

method markToBeDeleted [line 485]

void markToBeDeleted( )

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



Tags:

access:  public
throws:  DataSetException - if DataSet is not TableDataSet


[ Top ]

method markValueClean [line 518]

void markValueClean( string $col)

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



Tags:

access:  public


Parameters:

string   $col  

[ Top ]

method markValueDirty [line 528]

void markValueDirty( string $col)

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



Tags:

access:  public


Parameters:

string   $col  

[ Top ]

method needsToBeSaved [line 579]

boolean needsToBeSaved( )

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



Tags:

access:  public


[ Top ]

method recordIsClean [line 602]

true recordIsClean( )

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



Tags:

return:  if clean
access:  public


[ Top ]

method refresh [line 616]

void refresh( [Connection $conn = null])

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.



Tags:

access:  public
throws:  DataSetException
throws:  SQLException


Parameters:

Connection   $conn  

[ Top ]

method save [line 116]

boolean save( [Connection $conn = null])

Saves the data in this Record to the database.



Tags:

return:  True if the save completed. false otherwise.
access:  public
throws:  DataSetException


Parameters:

Connection   $conn  

[ Top ]

method setParentDataSet [line 719]

void setParentDataSet( DataSet $ds)

Sets the parent DataSet for this record.



Tags:

access:  public


Parameters:

DataSet   $ds  

[ Top ]

method setSaveType [line 538]

void setSaveType( int $type)

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



Tags:

access:  public


Parameters:

int   $type  

[ Top ]

method setValue [line 557]

Record setValue( mixed $col, mixed $value)

Sets the value of col.



Tags:

return:  this object.
access:  public
throws:  DataSetException


[ Top ]

method size [line 414]

the size( )

The number of columns in this object.



Tags:

return:  number of columns in this object
access:  public


[ Top ]

method toBeSavedWithDelete [line 441]

boolean toBeSavedWithDelete( )

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



Tags:

return:  True if saved with delete
access:  public


[ Top ]

method toBeSavedWithInsert [line 423]

boolean toBeSavedWithInsert( )

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



Tags:

return:  True if saved with insert
access:  public


[ Top ]

method toBeSavedWithUpdate [line 432]

boolean toBeSavedWithUpdate( )

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



Tags:

return:  True if saved with update
access:  public


[ Top ]

method unmarkToBeDeleted [line 504]

void unmarkToBeDeleted( )

Unmarks a record that has been marked for deletion.

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




Tags:

access:  public
throws:  DataSetException
see:  Record::markToBeDeleted()
see:  Record::markForInsert()
see:  Record::markForUpdate()


[ Top ]

method valueIsClean [line 590]

true valueIsClean( mixed $column)

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



Tags:

return:  if clean
access:  public
throws:  DataSetException


[ Top ]

method __toString [line 728]

string __toString( )

This returns a representation of this Record.



Tags:

access:  public


[ Top ]


Class Constants

AFTERDELETE =  9

[line 50]


[ Top ]

AFTERINSERT =  5

[line 46]


[ Top ]

AFTERUPDATE =  7

[line 48]


[ Top ]

BEFOREDELETE =  8

[line 49]


[ Top ]

BEFOREINSERT =  4

[line 45]


[ Top ]

BEFOREUPDATE =  6

[line 47]


[ Top ]

DELETE =  3

[line 44]


[ Top ]

INSERT =  1

[line 42]


[ Top ]

UNKNOWN =  0

[line 41]


[ Top ]

UPDATE =  2

[line 43]


[ Top ]

ZOMBIE =  -1

[line 40]


[ Top ]



Documentation generated on Mon, 23 Aug 2004 21:52:55 -0400 by phpDocumentor 1.3.0RC3