本文整理汇总了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;
}