Public Member Functions

mssqlStatement Class Reference

Public Member Functions

 __construct ($query, $connection, $autocommit=false, $savepoint=false)
 Constructor.
 bind ($param, $no_quotes=false)
 Escape query parameters.
 execute ()
 Execute prepared statement and return resultset methods.
 limit ($limit, $sql_version=false)
 Sets 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 mssqlStatement.php.


Constructor & Destructor Documentation

__construct ( query,
connection,
autocommit = false,
savepoint = false 
)

Constructor.

public

Parameters:
str $query
mixed $connection
bool $mssql_version

Definition at line 83 of file mssqlStatement.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 96 of file mssqlStatement.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 117 of file mssqlStatement.php.

    {
        $objResult = mssql_query( $this->objPrepareSQL() )
        or trigger_error( mssql_get_last_message(), E_USER_WARNING );

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

limit ( limit,
sql_version = false 
)

Sets limit int value.

public

Parameters:
int $limit
bool $sql_version

Definition at line 132 of file mssqlStatement.php.

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

objExecuteNonPrepared (  ) 

Execute non-prepared query and return resultset methods.

public

Returns:
mixed

Definition at line 145 of file mssqlStatement.php.

    {
        $objResult = mssql_query( $this->objQuery )
        or trigger_error( mssql_get_last_message(), E_USER_WARNING );

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

offset ( offset  ) 

Set offset int value.

public

Parameters:
int $offset

Definition at line 188 of file mssqlStatement.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 199 of file mssqlStatement.php.

{}


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