/** * Gets next result set (if this behavior is supported by driver). * Some drivers (e.g. MSSQL) support returning multiple result sets -- e.g. * from stored procedures. * * This function also closes any current restult set. * * Default behavior is for this function to return false. Driver-specific * implementations of this class can override this method if they actually * support multiple result sets. * * @return boolean True if there is another result set, otherwise false. */ public function getMoreResults() { if ($this->resultSet) { $this->resultSet->close(); } $this->resultSet = null; return false; }
/** * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object. * * @param array $params Parameters that will be set using PreparedStatement::set() before query is executed. * @return int Number of affected rows (or 0 for drivers that return nothing). * @throws SQLException if a database access error occurs. */ public function executeUpdate($params = null) { if ($params) { for ($i = 0, $cnt = count($params); $i < $cnt; $i++) { $this->set($i + 1, $params[$i]); } } if ($this->resultSet) { $this->resultSet->close(); } $this->resultSet = null; // reset $sql = $this->replaceParams(); $this->updateCount = $this->conn->executeUpdate($sql); return $this->updateCount; }
/** * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object. * * @param array $params Parameters that will be set using PreparedStatement::set() before query is executed. * @return int Number of affected rows (or 0 for drivers that return nothing). * @throws SQLException if a database access error occurs. */ public function executeUpdate($params = null) { foreach ((array) $params as $i => $param) { $this->set($i + 1, $param); unset($i, $param); } unset($params); if ($this->resultSet) { $this->resultSet->close(); } $this->resultSet = null; // reset $sql = $this->replaceParams(); $this->updateCount = $this->conn->executeUpdate($sql); return $this->updateCount; }
/** * Merge ResultSet into RowsAggregate * * @return RowsAggregate */ protected static function fetch_all(ResultSet $rs, ReflectionClass $class) { $results = new RowsAggregate(); while ($rs->next()) { $results->add($class->newInstance($rs->getRow())); } $rs->close(); return $results; }