예제 #1
0
파일: Statement.php 프로젝트: reoring/sabel
 public function execute($bindValues = array(), $additionalParameters = array(), $query = null)
 {
     $query = $this->getQuery();
     if (!empty($this->binaries)) {
         for ($i = 0, $c = count($this->binaries); $i < $c; $i++) {
             $query = str_replace("__sbl_binary" . ($i + 1), $this->binaries[$i]->getData(), $query);
         }
     }
     $result = parent::execute($bindValues, $additionalParameters, $query);
     if (!$this->isSelect() || empty($result)) {
         return $result;
     }
     $binaryColumns = array();
     foreach ($this->metadata->getColumns() as $column) {
         if ($column->isBinary()) {
             $binaryColumns[] = $column->name;
         }
     }
     if (!empty($binaryColumns)) {
         foreach ($result as &$row) {
             foreach ($binaryColumns as $colName) {
                 if (isset($row[$colName])) {
                     $row[$colName] = pg_unescape_bytea($row[$colName]);
                 }
             }
         }
     }
     return $result;
 }
예제 #2
0
파일: Statement.php 프로젝트: reoring/sabel
 public function execute($bindValues = array(), $additionalParameters = array(), $query = null)
 {
     $query = $this->getQuery();
     if (!empty($this->binaries)) {
         for ($i = 0, $c = count($this->binaries); $i < $c; $i++) {
             $query = str_replace("__sbl_binary" . ($i + 1), $this->binaries[$i]->getData(), $query);
         }
     }
     return parent::execute($bindValues, $additionalParameters, $query);
 }
예제 #3
0
파일: Statement.php 프로젝트: reoring/sabel
 public function execute($bindValues = array(), $additionalParameters = array(), $query = null)
 {
     $query = $this->getQuery();
     $blobs = $this->blobs;
     if (!empty($blobs)) {
         $cols = array();
         $hlds = array();
         foreach (array_keys($blobs) as $column) {
             $cols[] = $column;
             $hlds[] = ":" . $column;
         }
         $query .= " RETURNING " . implode(", ", $cols) . " INTO " . implode(", ", $hlds);
     }
     $additionalParameters["blob"] = $blobs;
     return parent::execute($bindValues, $additionalParameters, $query);
 }
예제 #4
0
 public function execute($bindValues = array(), $additionalParameters = array())
 {
     $this->query = preg_replace('/@([a-zA-Z0-9_]+)@/', ':$1', $this->getQuery());
     if (empty($bindValues)) {
         if (empty($this->bindValues)) {
             $bindValues = array();
         } else {
             $bindValues = $this->escape($this->bindValues);
             foreach ($bindValues as $k => $v) {
                 $bindValues[":{$k}"] = $v;
                 unset($bindValues[$k]);
             }
         }
     }
     return parent::execute($bindValues, $additionalParameters);
 }
예제 #5
0
파일: Statement.php 프로젝트: reoring/sabel
 public function execute($bindValues = array(), $additionalParameters = array())
 {
     $result = parent::execute($bindValues);
     if (!$this->isSelect() || empty($result) || !extension_loaded("mbstring")) {
         return $result;
     }
     $fromEnc = defined("SDB_MSSQL_ENCODING") ? SDB_MSSQL_ENCODING : "SJIS";
     $toEnc = mb_internal_encoding();
     $columns = $this->metadata->getColumns();
     foreach ($result as &$row) {
         foreach ($columns as $name => $column) {
             if (isset($row[$name]) && ($column->isString() || $column->isText())) {
                 $row[$name] = mb_convert_encoding($row[$name], $toEnc, $fromEnc);
             }
         }
     }
     return $result;
 }
예제 #6
0
 public function execute($bindValues = array(), $additionalParameters = array())
 {
     $result = parent::execute($bindValues, $additionalParameters);
     if (!$this->isSelect() || empty($result)) {
         return $result;
     }
     $binaryColumns = array();
     foreach ($this->metadata->getColumns() as $column) {
         if ($column->isBinary()) {
             $binaryColumns[] = $column->name;
         }
     }
     if (!empty($binaryColumns)) {
         foreach ($result as &$row) {
             foreach ($binaryColumns as $colName) {
                 if (isset($row[$colName])) {
                     $row[$colName] = pg_unescape_bytea($row[$colName]);
                 }
             }
         }
     }
     return $result;
 }
예제 #7
0
파일: Statement.php 프로젝트: reoring/sabel
 public function execute($bindValues = array(), $additionalParameters = array(), $query = null)
 {
     $query = preg_replace('/@([a-zA-Z0-9_]+)@/', ':$1', $this->getQuery());
     return parent::execute($bindValues, $additionalParameters, $query);
 }