00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 require_once 'creole/PreparedStatement.php';
00023 require_once 'creole/common/PreparedStatementCommon.php';
00024
00032 class MSSQLPreparedStatement extends PreparedStatementCommon implements PreparedStatement {
00033
00045 function setBlob($paramIndex, $blob)
00046 {
00047 $this->sql_cache_valid = false;
00048 if ($blob === null) {
00049 $this->setNull($paramIndex);
00050 } else {
00051
00052 if (is_object($blob)) {
00053 $blob = $blob->__toString();
00054 }
00055 $data = unpack("H*hex", $blob);
00056 $this->boundInVars[$paramIndex] = '0x'.$data['hex'];
00057 }
00058 }
00059
00060
00065 protected function escape($subject)
00066 {
00067
00068
00069 return str_replace("'", "''", $subject);
00070 }
00071
00075 public function executeQuery($p1 = null, $fetchmode = null)
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;
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 }
00099 }