Public Member Functions

firebirdStatement Class Reference

Public Member Functions

 __construct ($query, $connection, $autocommit, $savepoint)
 Constructor.
 bind ($param, $no_quotes=false)
 Set and escape bound query parameters.
 execute ()
 Execute prepared query and return resultset object.
 limit ($limit)
 Set limit int value.
 objExecuteNonPrepared ()
 Execute non-prepared query and return resultset object.
 offset ($offset)
 Set offset int value.
 sequence ($sequence)
 Get value for named sequence.

Detailed Description

Definition at line 17 of file firebirdStatement.php.


Constructor & Destructor Documentation

__construct ( query,
connection,
autocommit,
savepoint 
)

Constructor.

public

Parameters:
str $query
mixed $connection
bool $autocommit
str $savepoint

Definition at line 100 of file firebirdStatement.php.

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


Member Function Documentation

bind ( param,
no_quotes = false 
)

Set and escape bound query parameters.

public

Parameters:
mixed $param
bool $no_quotes

Definition at line 115 of file firebirdStatement.php.

    {
        //if $param is numeric str, do not add quotes
        if ( ( is_string( $param ) && !is_numeric( $param ) ) && !$no_quotes )
        {
            if ( get_magic_quotes_gpc() )
                $param = stripslashes( $param );

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

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

execute (  ) 

Execute prepared query and return resultset object.

public

Returns:
mixed

Definition at line 136 of file firebirdStatement.php.

    {
        if ( is_resource( $this->objAutoCommit ) && stripos( $this->objPrepareSQL(), 'select' ) === false )
        {
            if ( $this->objSavepoint )
                $objResult = ibase_query( $this->objSavepoint, $this->objPrepareSQL() )
                or trigger_error( ibase_errmsg(), E_USER_WARNING );
            else
                $objResult = ibase_query( $this->objAutoCommit, $this->objPrepareSQL() )
                or trigger_error( ibase_errmsg(), E_USER_WARNING );
        }
        else
        {
            $objResult = ibase_query( $this->objConnection->connection(), $this->objPrepareSQL() )
            or trigger_error( ibase_errmsg(), E_USER_WARNING );
        }

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

limit ( limit  ) 

Set limit int value.

public

Parameters:
int $limit

Definition at line 162 of file firebirdStatement.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 object.

public

Returns:
mixed

Definition at line 174 of file firebirdStatement.php.

    {
        if ( is_resource( $this->objAutoCommit ) && stripos( $this->objQuery, 'select' ) === false )
        {
            if ( $this->objSavepoint )
                $objResult = ibase_query( $this->objSavepoint, $this->objQuery )
                or trigger_error( ibase_errmsg(), E_USER_WARNING );
            else
                $objResult = ibase_query( $this->objAutoCommit, $this->objQuery )
                or trigger_error( ibase_errmsg(), E_USER_WARNING );
        }
        else
        {
            $objResult = ibase_query( $this->objConnection->connection(), $this->objQuery )
            or trigger_error( ibase_errmsg(), E_USER_WARNING );
        }

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

offset ( offset  ) 

Set offset int value.

public

Parameters:
int $offset

Definition at line 221 of file firebirdStatement.php.

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

sequence ( sequence  ) 

Get value for named sequence.

public

Parameters:
str $sequence

Definition at line 233 of file firebirdStatement.php.

    {
        $this->objSequence = ibase_gen_id( $sequence, 1, $this->objConnection->connection() );
    }


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