本文整理匯總了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;
}