Class mr_db_record

Description

Implements interfaces:

  • ArrayAccess (internal interface)
  • IteratorAggregate (internal interface)
  • Countable (internal interface)

MR DB Record

Table record abstraction. Keep track of changes and only write to db when necessary.

Located in /db/record.php (line 41)


	
			
Variable Summary
boolean $trustcolumns
object $_change
boolean $_delete
object $_record
Method Summary
mr_db_record __construct (mixed $table, [mixed $default = NULL], [boolean $trustcolumns = false])
int count ()
ArrayIterator|Traversable getIterator ()
array get_columns ()
boolean is_changed ()
boolean is_delete ()
boolean is_insert ()
boolean is_update ()
boolean offsetExists (string $offset)
mixed offsetGet (string $offset)
void offsetSet (string $offset, mixed $value)
void offsetUnset (string $offset)
mr_db_record save ([boolean $bulk = false])
mr_db_record set (mixed $data)
mixed __get (string $name)
bool __isset (string $name)
void __set (string $name, mixed $value)
void __unset (string $name)
Variables
boolean $trustcolumns = false (line 77)

If true, then checks for column exists are bypassed.

Only use when performance is an issue (EG: processing hundreds of thousands) and that you KNOW all columns are correct

  • access: protected
object $_change (line 61)

Changed values in the record

  • access: protected
boolean $_delete = false (line 68)

Is the record flagged to be deleted

  • access: protected
object $_record (line 54)

The record

  • access: protected
mr_db_table $_table (line 47)

The record's table

  • access: protected
Methods
Constructor __construct (line 88)

Constructor

  • access: public
mr_db_record __construct (mixed $table, [mixed $default = NULL], [boolean $trustcolumns = false])
  • mixed $table: The table name or an instance of mr_db_table
  • mixed $default: The default record data - just setting this will not trigger a save
  • boolean $trustcolumns: If true, then checks for column exists are bypassed. Only use when performance is an issue (EG: processing hundreds of thousands) and that you KNOW all columns are correct
count (line 243)

Return record count

Required by the Countable implementation

  • access: public
int count ()

Implementation of:
Countable::count
delete (line 384)

Delete the record.

  • throws: coding_exception
  • access: public
mr_db_record delete ()
getIterator (line 232)

Return an iterator to iterate over the record data

Required by the IteratorAggregate implementation

  • access: public
ArrayIterator|Traversable getIterator ()

Implementation of:
IteratorAggregate::getIterator
get_columns (line 279)

Get record column names that are currently set

  • access: public
array get_columns ()
get_table (line 270)

Get record's table

  • access: public
mr_db_table get_table ()
is_changed (line 325)

Does the record have changes to be saved?

Returns true when the record needs to be deleted or has changes that need to be saved.

  • access: public
boolean is_changed ()
is_delete (line 313)

Does the record need to be deleted?

  • access: public
boolean is_delete ()
is_insert (line 301)

Does the record need to be inserted?

  • access: public
boolean is_insert ()
is_update (line 289)

Does the record need updating?

  • access: public
boolean is_update ()
offsetExists (line 186)

Proxy to __isset

Required by the ArrayAccess implementation

  • access: public
boolean offsetExists (string $offset)
  • string $offset

Implementation of:
ArrayAccess::offsetExists
offsetGet (line 198)

Proxy to __get

Required by the ArrayAccess implementation

  • access: public
mixed offsetGet (string $offset)
  • string $offset

Implementation of:
ArrayAccess::offsetGet
offsetSet (line 210)

Proxy to __set

Required by the ArrayAccess implementation

  • access: public
void offsetSet (string $offset, mixed $value)
  • string $offset
  • mixed $value

Implementation of:
ArrayAccess::offsetSet
offsetUnset (line 221)

Proxy to __unset

Required by the ArrayAccess implementation

  • access: public
void offsetUnset (string $offset)
  • string $offset

Implementation of:
ArrayAccess::offsetUnset
queue_delete (line 373)

Flag the record for deletion, but don't actually delete it yet

This is mostly used in conjunction with mr_db_queue

  • access: public
mr_db_record queue_delete ()
save (line 344)

Save the record.

The record can either be deleted, updated or inserted based on record ID and current state. Only performs these actions if actually necessary.

  • throws: coding_exception
  • access: public
mr_db_record save ([boolean $bulk = false])
  • boolean $bulk: Bulk flag which gets passed to inserts and updates
set (line 256)

Set data to the record

Data names that do not match table columns will be ignored.

  • access: public
mr_db_record set (mixed $data)
  • mixed $data: An array or object of data
__get (line 150)

Get a record value

  • throws: coding_exception
  • access: public
mixed __get (string $name)
  • string $name
__isset (line 163)

If a record value isset

  • access: public
bool __isset (string $name)
  • string $name
__set (line 130)

Set a value to the record. Records changes.

  • throws: coding_exception
  • access: public
void __set (string $name, mixed $value)
  • string $name
  • mixed $value
__unset (line 173)

Unset a record value

  • access: public
void __unset (string $name)
  • string $name

Documentation generated on Thu, 28 Jun 2012 16:33:50 -0700 by phpDocumentor 1.4.3