class Doctrine_Sequence_Db2 extends Doctrine_Sequence (View source)

Doctrine_Sequence_Db2

Properties

protected Doctrine_Connection $conn from Doctrine_Connection_Module
protected string $moduleName from Doctrine_Connection_Module

Methods

__construct(Doctrine_Connection $conn = null)

No description

getConnection()

getConnection returns the connection object this module uses

string
getModuleName()

getModuleName returns the name of this module

integer
nextId(string $seqName, bool $ondemand = true)

Returns the next free id of a sequence

lastInsertId(string $tableName = null, string $primaryKey = null)

Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.

integer
currId(string $sequenceName)

Return the most recent value from the specified sequence in the database.

Details

__construct(Doctrine_Connection $conn = null)

Parameters

Doctrine_Connection $conn Doctrine_Connection object, every connection module holds an instance of Doctrine_Connection

Doctrine_Connection getConnection()

getConnection returns the connection object this module uses

Return Value

Doctrine_Connection

string getModuleName()

getModuleName returns the name of this module

Return Value

string the name of this module

integer nextId(string $seqName, bool $ondemand = true)

Returns the next free id of a sequence

Parameters

string $seqName name of the sequence
bool $ondemand when true missing sequences are automatic created

Return Value

integer next id in the given sequence

Exceptions

Doctrine_Sequence_Exception

lastInsertId(string $tableName = null, string $primaryKey = null)

Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.

As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded.

The IDENTITY_VAL_LOCAL() function gives the last generated identity value in the current process, even if it was for a GENERATED column.

Parameters

string $tableName OPTIONAL
string $primaryKey OPTIONAL

Exceptions

Doctrine_Adapter_Db2_Exception

integer currId(string $sequenceName)

Return the most recent value from the specified sequence in the database.

This is supported only on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2). Other RDBMS brands return null.

Parameters

string $sequenceName

Return Value

integer current id in the given sequence

Exceptions

Doctrine_Adapter_Db2_Exception