Apache Zeta Components - high quality PHP components

Apache Zeta Components Manual :: Docs For Class ezcPersistentSequenceGenerator

PersistentObject::ezcPersistentSequenceGenerator

Class ezcPersistentSequenceGenerator

Generates IDs based on the PDO::lastInsertId method.

It is recommended to use auto_increment id columns for databases supporting it. This includes MySQL and SQLite. Use ezcPersistentNativeGenerator for those!

For none auto_increment databases:

  1.  CREATE TABLE test ( id integer unsigned not null, PRIMARY KEY (id ));
  2.  CREATE SEQUENCE test_seq START 1;

This class reads the parameters:

  • sequence - The name of the database sequence keeping track of the ID. This field should be ommited for databases supporting auto_increment.

Source for this file: /PersistentObject/src/generators/sequence_generator.php

ezcPersistentIdentifierGenerator
   |
   --ezcPersistentSequenceGenerator
Version:   //autogen//

Method Summary

public int postSave( $def , $db )
Returns the integer value of the generated identifier for the new object.
public void preSave( $def , $db , $q )
Fetches the next sequence value for PostgreSQL and Oracle implementations.

Inherited Methods

From ezcPersistentIdentifierGenerator
public bool ezcPersistentIdentifierGenerator::checkPersistence()
Returns true if the object is persistent already.
public abstract int ezcPersistentIdentifierGenerator::postSave()
Returns the value of the generated identifier for the new object.
public abstract void ezcPersistentIdentifierGenerator::preSave()
Called prior to executing the insert query that saves the data to the database.

Methods

postSave

int postSave( ezcPersistentObjectDefinition $def , $db )

Returns the integer value of the generated identifier for the new object.

Called right after execution of the insert query. Dispatches to ezcPersistentNativeGenerator for MySQL.

Parameters:
Name Type Description
$def ezcPersistentObjectDefinition
$db ezcDbHandler
Redefinition of:
Method Description
ezcPersistentIdentifierGenerator::postSave() Returns the value of the generated identifier for the new object.

preSave

void preSave( ezcPersistentObjectDefinition $def , $db , $q )

Fetches the next sequence value for PostgreSQL and Oracle implementations.

Fetches the next sequence value for PostgreSQL and Oracle implementations. Dispatches to ezcPersistentNativeGenerator for MySQL.

Parameters:
Name Type Description
$def ezcPersistentObjectDefinition
$db ezcDbHandler
$q ezcQueryInsert
Redefinition of:
Method Description
ezcPersistentIdentifierGenerator::preSave() Called prior to executing the insert query that saves the data to the database.
Documentation generated by phpDocumentor 1.4.3