/** * Release resources allocated for the specified prepared query. * * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function free() { if (is_null($this->positions)) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; if (!is_null($this->statement)) { $connection = $this->db->getConnection(); if (PEAR::isError($connection)) { return $connection; } $query = 'DEALLOCATE PREPARE ' . $this->statement; $result = $this->db->_doQuery($query, true, $connection); } parent::free(); return $result; }
/** * Execute a prepared query statement helper method. * * @param mixed $result_class string which specifies which result class to use * @param mixed $result_wrap_class string which specifies which class to wrap results in * * @return mixed MDB2_Result or integer (affected rows) on success, * a MDB2 error on failure * @access private */ function _execute($result_class = true, $result_wrap_class = false) { if (is_null($this->statement)) { $result =& parent::_execute($result_class, $result_wrap_class); return $result; } $this->db->last_query = $this->query; $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values)); if ($this->db->getOption('disable_query')) { $result = $this->is_manip ? 0 : null; return $result; } $connection = $this->db->getConnection(); if (PEAR::isError($connection)) { return $connection; } $result = $this->statement->execute(); if ($result == false) { $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'cant execute statement', __FUNCTION__); } if ($this->is_manip) { $affected_rows = $this->db->_affectedRows($connection, $result); return $affected_rows; } $result =& $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset); $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result)); return $result; }
/** * Release resources allocated for the specified prepared query. * * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function free() { if (is_null($this->positions)) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; if (!is_null($this->statement) && !@OCIFreeStatement($this->statement)) { $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } parent::free(); return $result; }
/** * Release resources allocated for the specified prepared query. * * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function free() { if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; if (is_object($this->statement)) { if (!@mysqli_stmt_close($this->statement)) { $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } } elseif (null !== $this->statement) { $connection = $this->db->getConnection(); if (PEAR::isError($connection)) { return $connection; } $query = 'DEALLOCATE PREPARE ' . $this->statement; $result = $this->db->_doQuery($query, true, $connection); } parent::free(); return $result; }
/** * Release resources allocated for the specified prepared query. * * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public */ function free() { if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; if (null !== $this->statement && !@ibase_free_query($this->statement)) { $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } parent::free(); return $result; }