本文整理汇总了PHP中sqlite_seek函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_seek函数的具体用法?PHP sqlite_seek怎么用?PHP sqlite_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_seek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: seek
/**
* Seek
*
* @param int offset
* @return bool success
* @throws rdbms.SQLException
*/
public function seek($offset)
{
if (!sqlite_seek($this->handle, $offset)) {
throw new SQLException('Cannot seek to offset ' . $offset);
}
return TRUE;
}
示例2: rewind
function rewind()
{
if (isset($this->queryId) && is_resource($this->queryId) && sqlite_num_rows($this->queryId)) {
if (sqlite_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->limit . ' OFFSET ' . $this->offset;
}
$this->queryId = $this->connection->execute($query);
}
$this->key = 0;
$this->next();
}
示例3: reset
function reset()
{
if ($this->row > 0) {
sqlite_seek($this->id, 0);
}
$this->row = -1;
return TRUE;
}
示例4: seek
public function seek($offset)
{
if ($this->offsetExists($offset) && sqlite_seek($this->_result, $offset)) {
$this->_current_row = $this->_internal_row = $offset;
return true;
} else {
return false;
}
}
示例5: seek
/**
* @see ResultSet::seek()
*/
public function seek($rownum)
{
// MySQL rows start w/ 0, but this works, because we are
// looking to move the position _before_ the next desired position
if (!@sqlite_seek($this->result, $rownum)) {
return false;
}
$this->cursorPos = $rownum;
return true;
}
示例6: seek
public function seek($offset)
{
if ($this->offsetExists($offset) and sqlite_seek($this->_result, $offset)) {
// Set the current row to the offset
$this->_current_row = $this->_internal_row = $offset;
return TRUE;
} else {
return FALSE;
}
}
示例7: result
function result($query_id = 0, $row = 0, $field = NULL)
{
if ($query_id) {
if ($row != 0) {
@sqlite_seek($query_id, $row);
}
return @current(@sqlite_current($query_id));
} else {
return false;
}
}
示例8: fetch
/**
* Fetches the next result
* @return array
*/
function fetch()
{
if ($row = sqlite_fetch_array($this->query)) {
return $row;
} else {
if ($this->size() > 0) {
sqlite_seek($this->query, 0);
return false;
} else {
return false;
}
}
}
示例9: sqliteAdapter
/**
* 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 sqliteAdapter($d)
{
parent::RecordSetAdapter($d);
// grab all of the rows
$fieldcount = sqlite_num_fields($d);
$ob = "";
$fc = pack('N', $fieldcount);
if (sqlite_num_rows($d) > 0) {
sqlite_seek($d, 0);
while ($line = sqlite_fetch_array($d, SQLITE_NUM)) {
//Write array flag + length
$ob .= "\n" . $fc;
$to = count($line);
for ($i = 0; $i < $to; $i++) {
//Type everything as a string since this is sqlite
$value = $line[$i];
$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;
}
}
}
}
// grab the number of fields
// loop over all of the fields
for ($i = 0; $i < $fieldcount; $i++) {
// decode each field name ready for encoding when it goes through serialization
// and save each field name into the array
$this->columnNames[$i] = $this->_directCharsetHandler->transliterate(sqlite_field_name($d, $i));
}
$this->numRows = sqlite_num_rows($d);
$this->serializedData = $ob;
}
示例10: fetchSpecificRow
function fetchSpecificRow($num, $type = "", $stack = 0)
{
if ($type == "") {
$type = SQLITE_BOTH;
} else {
if ($type == "num") {
$type = SQLITE_NUM;
} else {
if ($type == "assoc") {
$type = SQLITE_ASSOC;
}
}
}
if (!$this->result[$stack]) {
log_message("DB: called fetchSpecificRow[{$stack}] but result is false");
return;
}
sqlite_seek($this->result[$stack], $num);
return @sqlite_fetch_array($this->result[$stack], $type);
}
示例11: fetchInto
/**
* Fetch a row and insert the data into an existing array.
*
* Formating of the array and the data therein are configurable.
* See DB_result::fetchInto() for more information.
*
* @param resource $result query result identifier
* @param array $arr (reference) array where data from the row
* should be placed
* @param int $fetchmode how the resulting array should be indexed
* @param int $rownum the row number to fetch
*
* @return mixed DB_OK on success, null when end of result set is
* reached or on failure
*
* @see DB_result::fetchInto()
* @access private
*/
function fetchInto($result, &$arr, $fetchmode, $rownum = null)
{
if ($rownum !== null) {
if (!@sqlite_seek($this->result, $rownum)) {
return null;
}
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
$arr = @sqlite_fetch_array($result, SQLITE_ASSOC);
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
} else {
$arr = @sqlite_fetch_array($result, SQLITE_NUM);
}
if (!$arr) {
/* See: http://bugs.php.net/bug.php?id=22328 */
return null;
}
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
/*
* Even though this DBMS already trims output, we do this because
* a field might have intentional whitespace at the end that
* gets removed by DB_PORTABILITY_RTRIM under another driver.
*/
$this->_rtrimArrayValues($arr);
}
if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
$this->_convertNullArrayValuesToEmpty($arr);
}
return DB_OK;
}
示例12: seek
/**
* Moves internal result pointer.
* @param resource $resultSet
* @param int $offset
* @return bool
* @throws DriverException
*/
public function seek($resultSet, $offset)
{
if ($this->unbuffered) {
throw new DriverException('Cannot seek on unbuffered result.');
}
return @sqlite_seek($resultSet, $offset);
}
示例13: resultSeek
/**
* Move internal result pointer
*
* Moves the pointer within the query result to a specified location, or
* to the beginning if nothing is specified.
*
* @param resource $result Resultset
* @param integer $rowNumber Row number
*
* @return boolean
*/
public function resultSeek($result, $rowNumber)
{
return sqlite_seek($result, $rowNumber);
}
示例14: sql_result
function sql_result($result, $row, $field = 0)
{
$check = sqlite_seek($result, $row);
if ($check === false) {
output_error("SQL Error: " . sql_error(), E_USER_ERROR);
return false;
}
$trow = sqlite_fetch_array($result);
$retval = $trow[$field];
return $retval;
}
示例15: seek
function seek($offset)
{
return sqlite_seek($this->id, $offset);
}