本文整理匯總了PHP中resource::data_seek方法的典型用法代碼示例。如果您正苦於以下問題:PHP resource::data_seek方法的具體用法?PHP resource::data_seek怎麽用?PHP resource::data_seek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類resource
的用法示例。
在下文中一共展示了resource::data_seek方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: seek
/**
* Seek to a specific record of the result set
*
* @param int $row The index of the row to position to (zero-based)
*
* @return void
*/
public function seek($row)
{
switch ($this->mode) {
case "mysql":
$this->result->data_seek($row);
break;
case "postgres":
case "redshift":
pg_result_seek($this->result, $row);
break;
case "odbc":
# The odbc driver doesn't support seeking, so we fetch specific rows in getNextRow(), and here all we need to do is set the current position instance variable
break;
case "sqlite":
$this->result->reset();
for ($i = 0; $i < $row; $i++) {
$this->result->fetchArray();
}
break;
case "mssql":
mssql_data_seek($this->result, $row);
break;
}
$this->position = $row;
}
示例2: seek
/**
* set the result pointer to offset
*
* @param int $pos
* @return boolean
*/
public function seek($pos)
{
if (!$this->result) {
return false;
}
if ($pos >= $this->numRows()) {
$pos = 0;
}
if ($this->result->data_seek($pos)) {
$this->pos = $pos;
return true;
} else {
return false;
}
}
示例3: mysqlDataSeek
/**
* @param resource|ResultWrapper $res
* @param int $row
* @return mixed
*/
protected function mysqlDataSeek($res, $row)
{
return $res->data_seek($row);
}
示例4: seek
public function seek($row)
{
if (is_object($this->handle)) {
return $this->handle->data_seek($row);
}
}
示例5: rewind
/**
* Rewind the result set
*
* @param resource $res
* @return boolean
*/
public function rewind($res)
{
if ($res and $res->num_rows > 0) {
return $res->data_seek(0);
}
return true;
}