Public Member Functions

sybaseStatement Class Reference

Public Member Functions

 __construct ($query, $connection)
 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 ()
 Dummy method to prevent class error for dbs that do not support sequences - used with prepared statement.

Detailed Description

Definition at line 17 of file sybaseStatement.php.


Constructor & Destructor Documentation

__construct ( query,
connection 
)

Constructor.

public

Parameters:
str $query
mixed $connection

Definition at line 74 of file sybaseStatement.php.

    {
        $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 87 of file sybaseStatement.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 statement and return resultset methods.

public

Returns:
mixed

Definition at line 108 of file sybaseStatement.php.

    {
        $objResult = sybase_query( $this->objPrepareSQL(), $this->objConnection->connection() )
        or trigger_error( sybase_get_last_message(), E_USER_WARNING );

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

limit ( limit  ) 

Set limit int value.

public

Parameters:
int $limit

Definition at line 122 of file sybaseStatement.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 134 of file sybaseStatement.php.

    {
        $objResult = sybase_query( $this->objQuery, $this->objConnection->connection() )
        or trigger_error( sybase_get_last_message(), E_USER_WARNING );

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

offset ( offset  ) 

Set offset int value.

public

Parameters:
int $offset

Definition at line 168 of file sybaseStatement.php.

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

sequence (  ) 

Dummy method to prevent class error for dbs that do not support sequences - used with prepared statement.

public

Definition at line 179 of file sybaseStatement.php.

{}


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