本文整理汇总了PHP中mysqli_data_seek函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_data_seek函数的具体用法?PHP mysqli_data_seek怎么用?PHP mysqli_data_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_data_seek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rewind
function rewind()
{
if (isset($this->queryId) && $this->_is_resource($this->queryId) && mysqli_num_rows($this->queryId)) {
if (mysqli_data_seek($this->queryId, 0) === false) {
$this->connection->_raiseError();
}
} elseif (!$this->queryId) {
$query = $this->query;
if (is_array($this->sort_params)) {
if (preg_match('~(?<=FROM).+\\s+ORDER\\s+BY\\s+~i', $query)) {
$query .= ',';
} else {
$query .= ' ORDER BY ';
}
foreach ($this->sort_params as $field => $order) {
$query .= $this->connection->quoteIdentifier($field) . " {$order},";
}
$query = rtrim($query, ',');
}
if ($this->limit) {
$query .= ' LIMIT ' . $this->offset . ',' . $this->limit;
}
$this->queryId = $this->connection->execute($query);
}
$this->key = 0;
$this->next();
}
示例2: seek
/**
* Seek
*
* @param int offset
* @return bool success
* @throws rdbms.SQLException
*/
public function seek($offset)
{
if (!mysqli_data_seek($this->handle, $offset)) {
throw new SQLException('Cannot seek to offset ' . $offset);
}
return true;
}
示例3: old_mysql_result
/**
* Fonction basée sur l'api mysqli et
* simulant la fonction mysql_result()
* Copyright 2014 Marc Leygnac
*
* @param type $result résultat après requête
* @param integer $row numéro de la ligne
* @param string/integer $field indice ou nom du champ
* @return type valeur du champ ou false si erreur
*/
function old_mysql_result($result, $row, $field = 0)
{
if ($result === false) {
return false;
}
if ($row >= mysqli_num_rows($result)) {
return false;
}
if (is_string($field) && !(strpos($field, ".") === false)) {
// si $field est de la forme table.field ou alias.field
// on convertit $field en indice numérique
$t_field = explode(".", $field);
$field = -1;
$t_fields = mysqli_fetch_fields($result);
for ($id = 0; $id < mysqli_num_fields($result); $id++) {
if ($t_fields[$id]->table == $t_field[0] && $t_fields[$id]->name == $t_field[1]) {
$field = $id;
break;
}
}
if ($field == -1) {
return false;
}
}
mysqli_data_seek($result, $row);
$line = mysqli_fetch_array($result);
return isset($line[$field]) ? $line[$field] : false;
}
示例4: getAllScheduleTimeslotsBetween
function getAllScheduleTimeslotsBetween($startTime, $endTime)
{
$timeslots = array();
$result = openConnection("Call get_all_schedule_timeslots();");
//var_dump($result);
//$result = openConnection("get_all_schedule_timeslots_between(".$startTime.", ".$endTime.");");
$timeslots;
if ($result->num_rows > 0) {
mysqli_data_seek($result, 0);
while ($row = $result->fetch_assoc()) {
$startTime = $row['startTime'];
$endTime = $row['endTime'];
$timeslotId = $row['timeslotId'];
$firefighterId = $row['firefighterId'];
$firstName = $row['firstName'];
$lastName = $row['lastName'];
$email = $row['email'];
$phone = $row['phone'];
$secondaryPhone = $row['secondaryPhone'];
$carrier = $row['phoneProvider'];
$scheduleTimeslotId = $row['scheduleTimeslotId'];
$firefighter = new Firefighter($firefighterId, $firstName, $lastName, $email, $phone, $secondaryPhone, $carrier);
$timeslot = new TimeSlot($timeslotId, $startTime, $endTime, $firefighter);
$scheduleTimeslot = new ScheduleTimeslot($timeslot, $scheduleTimeslotId);
array_push($timeslots, $scheduleTimeslot);
}
}
return $timeslots;
}
示例5: rewind
public function rewind()
{
if ($this->index > 0) {
@mysqli_data_seek($this->resource, 0);
$this->index = 0;
}
$this->next();
}
示例6: seek
/**
* Moves the internal pointer to the specified row position.
*
* @param int $row Row position; zero-based and set to 0 by default
*
* @return bool Boolean true on success, false otherwise
*/
public function seek($row = 0)
{
if (is_int($row) && $row >= 0 && $row < $this->num_rows) {
return mysqli_data_seek($this->result, $row);
} else {
return false;
}
}
示例7: rowSeek
public function rowSeek($rowNum)
{
$re = @mysqli_data_seek($this->query_result, $rowNum);
if (!$re) {
throw new Exception($this->errorInfo());
}
return $re;
}
示例8: fetch_result
function fetch_result($result, $row, $param)
{
if (mysqli_data_seek($result, $row)) {
$line = mysqli_fetch_assoc($result);
return $line[$param];
}
return false;
}
示例9: reset
function reset()
{
if ($this->row > 0) {
mysqli_data_seek($this->id, 0);
}
$this->row = -1;
return TRUE;
}
示例10: Reset
function Reset()
{
if ($this->ctype == 'mysqli') {
mysqli_data_seek($this->result, 0);
} else {
mysql_data_seek($this->result, 0);
}
return TRUE;
}
示例11: next
function next()
{
$this->cur++;
if ($this->cur > $this->max) {
return false;
}
mysqli_data_seek($this->res, $this->cur);
return mysqli_fetch_assoc($this->res);
}
示例12: seek
public function seek($offset)
{
if ($this->offsetExists($offset) && \mysqli_data_seek($this->_result, $offset)) {
$this->_current_row = $this->_internal_row = $offset;
return true;
} else {
return false;
}
}
示例13: mysqliAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* @param resource $d The datasource resource
*/
function mysqliAdapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = mysqli_num_fields($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (mysqli_num_rows($d) > 0) {
mysqli_data_seek($d, 0);
while ($line = mysqli_fetch_row($d)) {
// write all of the array elements
$ob .= "\n" . $fc;
foreach ($line as $value) {
// write all of the array elements
if (is_string($value)) {
// type as string
$os = $this->_directCharsetHandler->transliterate($value);
//string flag, string length, and string
$len = strlen($os);
if ($len < 65536) {
$ob .= "" . pack('n', $len) . $os;
} else {
$ob .= "\f" . pack('N', $len) . $os;
}
} elseif (is_float($value) || is_int($value)) {
// type as double
$b = pack('d', $value);
// pack the bytes
if ($be) {
// if we are a big-endian processor
$r = strrev($b);
} else {
// add the bytes to the output
$r = $b;
}
$ob .= "" . $r;
} elseif (is_bool($value)) {
//type as bool
$ob .= "";
$ob .= pack('c', $value);
} elseif (is_null($value)) {
// null
$ob .= "";
}
}
}
}
$this->serializedData = $ob;
// loop over all of the fields
while ($field = mysqli_fetch_field($d)) {
// decode each field name ready for encoding when it goes through serialization
// and save each field name into the array
$this->columnNames[] = $this->_directCharsetHandler->transliterate($field->name);
}
$this->numRows = mysqli_num_rows($d);
}
示例14: data_seek
function data_seek($result, $row = 0, $dbtype = 'mysql')
{
if ($dbtype == 'mysql') {
mysqli_data_seek($result, $row);
} else {
if ($dbtype == 'postgres') {
pg_result_seek($result, $row);
}
}
}
示例15: seek
public function seek($offset)
{
if ($this->offsetExists($offset) and mysqli_data_seek($this->_result, $offset)) {
// Set the current row to the offset
$this->_current_row = $this->_internal_row = $offset;
return TRUE;
} else {
return FALSE;
}
}