MSSQLPreparedStatement Class Reference

Inheritance diagram for MSSQLPreparedStatement:

PreparedStatementCommon PreparedStatement MSSQLCallableStatement

List of all members.

Public Member Functions

 setBlob ($paramIndex, $blob)
 MSSQL-specific implementation of setBlob().
 executeQuery ($p1=null, $fetchmode=null)
 MSSQL must emulate OFFSET/LIMIT support.

Protected Member Functions

 escape ($subject)
 Add quotes using str_replace.


Detailed Description

Definition at line 32 of file MSSQLPreparedStatement.php.


Member Function Documentation

MSSQLPreparedStatement::escape ( subject  )  [protected]

Add quotes using str_replace.

This is not as thorough as MySQL.

Reimplemented from PreparedStatementCommon.

Definition at line 65 of file MSSQLPreparedStatement.php.

00066     {
00067         // use this instead of magic_quotes_sybase + addslashes(),
00068         // just in case multiple RDBMS being used at the same time
00069         return str_replace("'", "''", $subject);
00070     }

MSSQLPreparedStatement::executeQuery ( p1 = null,
fetchmode = null 
)

MSSQL must emulate OFFSET/LIMIT support.

Reimplemented from PreparedStatementCommon.

Reimplemented in MSSQLCallableStatement.

Definition at line 75 of file MSSQLPreparedStatement.php.

References PreparedStatementCommon::$sql, and PreparedStatementCommon::replaceParams().

00076     {    
00077         $params = null;
00078         if ($fetchmode !== null) {
00079             $params = $p1;
00080         } elseif ($p1 !== null) {
00081             if (is_array($p1)) $params = $p1;
00082             else $fetchmode = $p1;
00083         }
00084         
00085         if ($params) {
00086             for($i=0,$cnt=count($params); $i < $cnt; $i++) {
00087                 $this->set($i+1, $params[$i]);
00088             }
00089         }
00090         
00091         $this->updateCount = null; // reset
00092         $sql = $this->replaceParams();                
00093         
00094         $this->resultSet = $this->conn->executeQuery($sql, $fetchmode);
00095         $this->resultSet->_setOffset($this->offset);
00096         $this->resultSet->_setLimit($this->limit);                
00097         return $this->resultSet;
00098     }

MSSQLPreparedStatement::setBlob ( paramIndex,
blob 
)

MSSQL-specific implementation of setBlob().

If you are having trouble getting BLOB data into the database, see the phpdoc comment in the MSSQLConnection for some PHP ini values that may need to be set. (This also applies to CLOB support.)

Parameters:
int $paramIndex
mixed $value Blob object or string.
Returns:
void

Reimplemented from PreparedStatementCommon.

Definition at line 45 of file MSSQLPreparedStatement.php.

References PreparedStatementCommon::setNull().

00046     {
00047       $this->sql_cache_valid = false;
00048         if ($blob === null) {
00049             $this->setNull($paramIndex);
00050         } else {
00051             // they took magic __toString() out of PHP5.0.0; this sucks
00052             if (is_object($blob)) {
00053                 $blob = $blob->__toString();
00054             }            
00055             $data = unpack("H*hex", $blob);
00056             $this->boundInVars[$paramIndex] = '0x'.$data['hex']; // no surrounding quotes!
00057         }        
00058     }


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

Generated on Wed May 6 23:10:50 2009 for fareofficelib by  doxygen 1.5.8