Public Member Functions

oracleStatement Class Reference

Public Member Functions

 __construct ($query, $connection, $autocommit)
 Constructor.
 bind ($param, $no_quotes=false)
 Escape query parameters.
 execute ()
 Execute prepared statement and return resultset methods.
 limit ($limit)
 Set limit int value.
 objExecuteNonPrepared ()
 Execute non-prepared query and return resultset methods.
 offset ($offset)
 Set offset int value.
 sequence ($sequence)
 Set property for named sequence.

Detailed Description

Definition at line 17 of file oracleStatement.php.


Constructor & Destructor Documentation

__construct ( query,
connection,
autocommit 
)

Constructor.

public

Parameters:
str $query
mixed $connection
bool $autocommit

Definition at line 99 of file oracleStatement.php.

    {
        $this->objAutoCommit = $autocommit;
        $this->objConnection = $connection;
        $this->objQuery      = $query;
    }


Member Function Documentation

bind ( param,
no_quotes = false 
)

Escape query parameters.

public

Parameters:
mixed $param
bool $no_quotes

Definition at line 113 of file oracleStatement.php.

    {
        if ( ( is_string( $param ) && !is_numeric( $param ) ) && !$no_quotes && substr_count( strtolower( $param ), 'nextval' ) == 0 )
        {
            if ( get_magic_quotes_gpc() )
                $param = stripslashes( $param );

            $param = str_replace( "'", "''", $param );
            $param = "'" . $param . "'";
        }

        $this->objParameters[] = $param;
    }

execute (  ) 

Execute prepared statement and return resultset methods.

public

Returns:
mixed

Definition at line 133 of file oracleStatement.php.

    {
        $this->objResult = oci_parse( $this->objConnection->connection(), $this->objPrepareSQL() );

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

        if ( !$this->objAutoCommit )
            $objStmt = oci_execute( $this->objResult, OCI_DEFAULT );
        else
            $objStmt = oci_execute( $this->objResult );

        if ( !$objStmt )
        {
            $objError = oci_error( $this->objResult );
            trigger_error( $objError['message'], E_USER_WARNING );
        }

        return new oracleResultset( $this->objResult, $this->objConnection->connection() );

    }

limit ( limit  ) 

Set limit int value.

public

Parameters:
int $limit

Definition at line 164 of file oracleStatement.php.

    {
        //make sure $limit is an unsigned int > 0
        $this->objLimit = ( is_numeric( $limit ) && $limit > 0 ) ? ( int )$limit : 1;
    }

objExecuteNonPrepared (  ) 

Execute non-prepared query and return resultset methods.

public

Returns:
mixed

Definition at line 176 of file oracleStatement.php.

    {
        $this->objResult = oci_parse( $this->objConnection->connection(), $this->objQuery );

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

        if ( !$this->objAutoCommit )
            $objStmt = oci_execute( $this->objResult, OCI_DEFAULT );
        else
            $objStmt = oci_execute( $this->objResult );

        if ( !$objStmt )
        {
            $objError = oci_error( $this->objResult );
            trigger_error( $objError['message'], E_USER_WARNING );
        }

        return new oracleResultset( $this->objResult, $this->objConnection->connection() );
    }

offset ( offset  ) 

Set offset int value.

public

Parameters:
int $offset

Definition at line 228 of file oracleStatement.php.

    {
        //make sure $offset is an unsigned int > 0
        $this->objOffset = ( is_numeric( $offset ) && $offset > 0 ) ? ( int )$offset : 1;
    }

sequence ( sequence  ) 

Set property for named sequence.

public

Parameters:
str $sequence

Definition at line 240 of file oracleStatement.php.

    {
         $this->objSequence = $sequence . '.NEXTVAL';
    }


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