Public Member Functions

oracleSequence Class Reference

Public Member Functions

 __construct ($sequence, $max, $connection)
 Constructor.
 getSequence ()
 Return property for named sequence.
 setSequence ()
 Create sequence object.

Detailed Description

Definition at line 15 of file oracleSequence.php.


Constructor & Destructor Documentation

__construct ( sequence,
max,
connection 
)

Constructor.

public

Parameters:
str $sequence
int $max
mixed $connection

Definition at line 57 of file oracleSequence.php.

    {
        $this->objConnection = $connection;
        $this->objMax        = $max;
        $this->objSequence   = $sequence;
    }


Member Function Documentation

getSequence (  ) 

Return property for named sequence.

public

Returns:
str

Definition at line 70 of file oracleSequence.php.

    {
        return $this->objSequence . '.NEXTVAL';
    }

setSequence (  ) 

Create sequence object.

public

Returns:
bool

Definition at line 81 of file oracleSequence.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 . ' START WITH 1 INCREMENT BY 1 MINVALUE 1' . $objMax . ' NOCACHE';

        $objParse = oci_parse( $this->objConnection, $objSeq );

        if ( !$objParse )
        {
            $objError = oci_error( $this->objConnection );
            trigger_error( $objError['message'], E_USER_WARNING );
            return false;
        }

        $objStmt = oci_execute( $objParse );

        if ( !$objStmt )
        {
            $objError = oci_error( $objParse );
            trigger_error( $objError['message'], E_USER_WARNING );
        }

        return $objStmt;
    }


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