You are here

function DB_common::setFetchMode in Flickr API 5

Sets the fetch mode that should be used by default for query results

Parameters

integer $fetchmode DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC: or DB_FETCHMODE_OBJECT

string $object_class the class name of the object to be returned: by the fetch methods when the DB_FETCHMODE_OBJECT mode is selected. If no class is specified by default a cast to object from the assoc array row will be done. There is also the posibility to use and extend the 'DB_row' class.

See also

DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT

File

phpFlickr/PEAR/DB/common.php, line 493

Class

DB_common
DB_common is the base class from which each database driver class extends

Code

function setFetchMode($fetchmode, $object_class = 'stdClass') {
  switch ($fetchmode) {
    case DB_FETCHMODE_OBJECT:
      $this->fetchmode_object_class = $object_class;
    case DB_FETCHMODE_ORDERED:
    case DB_FETCHMODE_ASSOC:
      $this->fetchmode = $fetchmode;
      break;
    default:
      return $this
        ->raiseError('invalid fetchmode mode');
  }
}