Public Member Functions | |
__construct ($sequence, $max, $connection) | |
Constructor. | |
getSequence () | |
Return property for named sequence. | |
setSequence () | |
Create sequence object. |
Definition at line 15 of file pgsqlSequence.php.
__construct | ( | $ | sequence, | |
$ | max, | |||
$ | connection | |||
) |
Constructor.
public
str | $sequence | |
int | $max | |
mixed | $connection |
Definition at line 57 of file pgsqlSequence.php.
{ $this->objConnection = $connection; $this->objMax = $max; $this->objSequence = $sequence; }
getSequence | ( | ) |
Return property for named sequence.
public
Definition at line 70 of file pgsqlSequence.php.
{ return "NEXTVAL('" . $this->objSequence . "')"; }
setSequence | ( | ) |
Create sequence object.
public
Definition at line 81 of file pgsqlSequence.php.
{ //make sure $this->objMax is an unsigned int > 0 $objMax = ( is_numeric( $this->objMax ) && $this->objMax > 0 ) ? ' MAXVALUE ' . ( int )$this->objMax : ''; $objSeq = 'CREATE SEQUENCE ' . $this->objSequence . ' INCREMENT 1 MINVALUE 1' . $objMax . ' START 1'; return pg_query( $this->objConnection, $objSeq ) or trigger_error( pg_last_error( $this->objConnection ), E_USER_WARNING ); }