本文整理汇总了PHP中ResultSet::close方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultSet::close方法的具体用法?PHP ResultSet::close怎么用?PHP ResultSet::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultSet
的用法示例。
在下文中一共展示了ResultSet::close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMoreResults
/**
* 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;
}
示例2: executeUpdate
/**
* 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;
}
示例3: executeUpdate
/**
* 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;
}
示例4: fetch_all
/**
* 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;
}