/**
  * make execute return the result instead of a bool
  *
  * @param array $input
  * @return \OC_DB_StatementWrapper|int
  */
 public function execute($input = array())
 {
     if (OC_Config::getValue("log_query", false)) {
         $params_str = str_replace("\n", " ", var_export($input, true));
         OC_Log::write('core', 'DB execute with arguments : ' . $params_str, OC_Log::DEBUG);
     }
     $this->lastArguments = $input;
     if (count($input) > 0) {
         if (!isset($type)) {
             $type = OC_Config::getValue("dbtype", "sqlite");
         }
         if ($type == 'mssql') {
             $input = $this->tryFixSubstringLastArgumentDataForMSSQL($input);
         }
         $result = $this->statement->execute($input);
     } else {
         $result = $this->statement->execute();
     }
     if ($result === false) {
         return false;
     }
     if ($this->isManipulation) {
         $this->statement->closeCursor();
         return $this->statement->rowCount();
     } else {
         return $this;
     }
 }
 /**
  * Executes one-time cleanup tasks at the end of a hydration that was initiated
  * through {@link hydrateAll} or {@link iterate()}.
  *
  * @return void
  */
 protected function cleanup()
 {
     $this->_stmt->closeCursor();
     $this->_stmt = null;
     $this->_rsm = null;
     $this->_cache = array();
     $this->_metadataCache = array();
 }
Пример #3
0
 /**
  * Closes the cursor, enabling the statement to be executed again.
  *
  * @return boolean              Returns TRUE on success or FALSE on failure.
  */
 public function closeCursor()
 {
     $this->statement->closeCursor();
     if ($this->emptied && $this->data !== null) {
         $data = $this->resultCache->fetch($this->cacheKey);
         if (!$data) {
             $data = array();
         }
         $data[$this->realKey] = $this->data;
         $this->resultCache->save($this->cacheKey, $data, $this->lifetime);
         unset($this->data);
     }
 }
 protected function assertTableKeys($expected, Statement $query, $keyName)
 {
     $query->execute();
     $users = array();
     while ($row = $query->fetch()) {
         $users[] = $row[$keyName];
     }
     $query->closeCursor();
     $users = array_unique($users);
     sort($users);
     sort($expected);
     $this->assertEquals($expected, $users);
 }
Пример #5
0
 /**
  * Frees all the memory associated with the provided result identifier.
  * @return bool     Returns TRUE on success or FALSE on failure.
  * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets.
  * Anyway, all associated result memory is automatically freed at the end of the script's execution.
  */
 public static function free_result(Statement $result)
 {
     $result->closeCursor();
 }
Пример #6
0
 /**
  * Executes one-time cleanup tasks at the end of a hydration that was initiated
  * through {@link hydrateAll} or {@link iterate()}.
  *
  * @return void
  */
 protected function cleanup()
 {
     $this->_rsm = null;
     $this->_stmt->closeCursor();
     $this->_stmt = null;
 }
 public function closeCursor()
 {
     return $this->stmt->closeCursor();
 }
Пример #8
0
 public function closeCursor()
 {
     return $this->wrapped->closeCursor();
 }
Пример #9
0
 /**
  * Automatically free the result
  */
 public function __destruct()
 {
     $this->resultSet = null;
     $this->resResult->closeCursor();
 }
Пример #10
0
 /**
  * Frees all the memory associated with the provided result identifier.
  * @return bool        Returns TRUE on success or FALSE on failure.
  * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets.
  * Anyway, all associated result memory is automatically freed at the end of the script's execution.
  */
 public static function free_result(Statement $result)
 {
     $result->closeCursor();
     //return mysql_free_result($result);
 }
Пример #11
0
 /**
  * Frees all the memory associated with the provided result identifier.
  * @return bool        Returns TRUE on success or FALSE on failure.
  * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets.
  * Anyway, all associated result memory is automatically freed at the end of the script's execution.
  */
 public static function free_result(\Doctrine\DBAL\Driver\Statement $result)
 {
     $result->closeCursor();
     //return mysql_free_result($result);
 }