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

Class: DatabaseIterator

Source Location: /database_iterator.class.php

Class Overview

ArrayObject
   |
   --DatabaseIterator

Class DatabaseIterator


Author(s):

Version:

  • 0.1

Implements interfaces:

  • Iterator (internal interface)
  • ArrayAccess (internal interface)

Variables

Methods


Inherited Constants

Class: ArrayObject (Internal Class)

ARRAY_AS_PROPS = 2
STD_PROP_LIST = 1

Inherited Methods

Class: ArrayObject (Internal Class)

constructor __construct ( $array )
append ( $value )
asort ( )
count ( )
exchangeArray ( $array )
getArrayCopy ( )
getFlags ( )
getIterator ( )
getIteratorClass ( )
ksort ( )
natcasesort ( )
natsort ( )
offsetExists ( $index )
offsetGet ( $index )
offsetSet ( $index, $newval )
offsetUnset ( $index )
setFlags ( $flags )
setIteratorClass ( $iteratorClass )
uasort ( $cmp_function )
uksort ( $cmp_function )

Class Details

[line 42]
Class DatabaseIterator

DatabaseIterator use TableIterator, RowIterator and ColumnIterator classes to manipulate database using SPL features. This class implements Iterator and ArrayAccess interfaces; and extends of ArrayObject

  1.  // $conn is an ADOConnection object
  2.  $dbIt new DatabaseIterator($conn);
  3.  foreach($dbIt as $table// loop tables
  4.      foreach($table as $row// loop rows
  5.          echo $row// call to __toString() method
  6.      }
  7.  }
  8.  
  9.  $dbIt['tablename']->select('field1, field2')->where('field1 LIKE "%number%"')->limit('0, 10');
  10.  foreach($dbIt['tablename'as $row{
  11.     echo $row->field1;
  12.  
  13.     $row->field2 += 1;
  14.     $row->update();
  15.  }




Tags:

version:  0.1
see:  ColumnIterator
see:  TableIterator
see:  RowIterator


[ Top ]


Class Variables

$conn =  null

[line 47]



Tags:

var:  ADOdb connection instance
access:  public

Type:   ADOConnection


[ Top ]

$databasename =  null

[line 53]



Tags:

var:  Database name
access:  public

Type:   string


[ Top ]



Class Methods


constructor __construct [line 65]

DatabaseIterator __construct( [ADOConnection $conn = null])



Tags:

see:  DatabaseIterator::setConnection()
access:  public


Overrides ArrayObject::constructor __construct ( $array ) (parent method not documented)

Parameters:

ADOConnection   $conn  

[ Top ]

method checkLoadTables [line 106]

void checkLoadTables( )

Test if $_tables internal array has data, otherwise call to loadTables



Tags:

access:  protected
uses:  DatabaseIterator::loadTables()


[ Top ]

method current [line 146]

void current( )




Implementation of:
Iterator::current
[ Top ]

method each [line 132]

void each( string $callback)

Iterate across tables calling to $callback with table parameter

  1.  $foo create_function('$table''echo $table->name;');
  2.  $dbIt->each($foo);




Tags:

link:  www.php.net/create_function
access:  public


Parameters:

string   $callback   Callback name or lambda function (create_function)

[ Top ]

method from [line 117]

TableIterator from( $tablename)

Select a table



Tags:

return:  Return a TableIterator object to method chaining
access:  public


Parameters:

   $tablename  

[ Top ]

method key [line 151]

void key( )




Implementation of:
Iterator::key
[ Top ]

method loadTables [line 92]

void loadTables( )

Set $_tables internal array with TableIterator objects



Tags:

see:  TableIterator
access:  public
usedby:  DatabaseIterator::checkLoadTables()


[ Top ]

method next [line 156]

void next( )




Implementation of:
Iterator::next
[ Top ]

method offsetExists [line 173]

void offsetExists( $offset)



Tags:

access:  public



Implementation of:
ArrayAccess::offsetExists
Overrides ArrayObject::offsetExists ( $index ) (parent method not documented)

Parameters:

   $offset  

[ Top ]

method offsetGet [line 183]

void offsetGet( $offset)



Tags:

access:  public



Implementation of:
ArrayAccess::offsetGet
Overrides ArrayObject::offsetGet ( $index ) (parent method not documented)

Parameters:

   $offset  

[ Top ]

method offsetSet [line 167]

void offsetSet( $offset, $value)



Tags:

access:  public



Implementation of:
ArrayAccess::offsetSet
Overrides ArrayObject::offsetSet ( $index, $newval ) (parent method not documented)

Parameters:

   $offset  
   $value  

[ Top ]

method offsetUnset [line 178]

void offsetUnset( $offset)



Tags:

access:  public



Implementation of:
ArrayAccess::offsetUnset
Overrides ArrayObject::offsetUnset ( $index ) (parent method not documented)

Parameters:

   $offset  

[ Top ]

method rewind [line 141]

void rewind( )




Implementation of:
Iterator::rewind
[ Top ]

method setConnection [line 76]

void setConnection( ADOConnection $conn)

Set a internal connection instance



Tags:

access:  public


Parameters:

ADOConnection   $conn   ADOConnection instance

[ Top ]

method valid [line 161]

void valid( )




Implementation of:
Iterator::valid
[ Top ]


Documentation generated on Mon, 25 May 2009 19:28:28 +0200 by phpDocumentor 1.4.2