Doctrine 1.2.4
Doctrine_Sequence_Oracle Class Reference

Inherits Doctrine_Sequence.

Public Member Functions

 currId ($seqName)
 
 getConnection ()
 
 getModuleName ()
 
 lastInsertId ($table=null, $field=null)
 
 lastInsertID ($table=null, $field=null)
 
 nextID ($seqName, $onDemand=true)
 
 nextId ($seqName, $ondemand=true)
 

Detailed Description

Definition at line 33 of file Oracle.php.

Member Function Documentation

Doctrine_Sequence_Oracle::currId (   $seqName)

Returns the current id of a sequence

Parameters
string$seqNamename of the sequence
Returns
integer current id in the given sequence

Definition at line 89 of file Oracle.php.

{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true);
$query = 'SELECT (last_number-1) FROM user_sequences';
$query .= ' WHERE sequence_name=' . $this->conn->quote($sequenceName, 'text');
$query .= ' OR sequence_name=' . $this->conn->quote(strtoupper($sequenceName), 'text');
return $this->conn->fetchOne($query);
}
Doctrine_Connection_Module::getConnection ( )
inherited

getConnection returns the connection object this module uses

Returns
Doctrine_Connection

Definition at line 68 of file Module.php.

{
return $this->conn;
}
Doctrine_Connection_Module::getModuleName ( )
inherited

getModuleName returns the name of this module

Returns
string the name of this module

Definition at line 79 of file Module.php.

{
return $this->moduleName;
}
Doctrine_Sequence::lastInsertId (   $table = null,
  $field = null 
)
inherited

Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)

Parameters
stringname of the table into which a new row was inserted
stringname of the field into which a new row was inserted

Definition at line 57 of file Sequence.php.

{
throw new Doctrine_Sequence_Exception('method not implemented');
}
Doctrine_Sequence_Oracle::lastInsertID (   $table = null,
  $field = null 
)

Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)

Parameters
stringname of the table into which a new row was inserted
stringname of the field into which a new row was inserted

Definition at line 74 of file Oracle.php.

{
$seqName = $table . (empty($field) ? '' : '_'.$field);
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true);
return $this->conn->fetchOne('SELECT ' . $sequenceName . '.currval FROM DUAL');
}
Doctrine_Sequence_Oracle::nextID (   $seqName,
  $onDemand = true 
)

Returns the next free id of a sequence

Parameters
string$seqNamename of the sequence
boolonDemand when true missing sequences are automatic created
Returns
integer next id in the given sequence

Definition at line 43 of file Oracle.php.

{
$sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true);
$query = 'SELECT ' . $sequenceName . '.nextval FROM DUAL';
try {
$result = $this->conn->fetchOne($query);
if ($onDemand && $e->getPortableCode() == Doctrine_Core::ERR_NOSUCHTABLE) {
try {
$result = $this->conn->export->createSequence($seqName);
} catch(Doctrine_Exception $e) {
throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created');
}
return $this->nextId($seqName, false);
} else {
throw new Doctrine_Sequence_Exception('sequence ' .$seqName . ' does not exist');
}
}
return $result;
}
Doctrine_Sequence::nextId (   $seqName,
  $ondemand = true 
)
inherited

Returns the next free id of a sequence

Parameters
string$seqNamename of the sequence
boolwhen true missing sequences are automatic created
Returns
integer next id in the given sequence
Exceptions
Doctrine_Sequence_Exception

Definition at line 45 of file Sequence.php.

{
throw new Doctrine_Sequence_Exception('method not implemented');
}

The documentation for this class was generated from the following file: