protected function db2Arr(SQLite3Result $data) { $arr = []; while ($row = $data->fetchArray(SQLITE3_ASSOC)) { $arr[] = $row; } return $arr; }
public function nextRecord() { if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) { return $data; } else { return false; } }
/** * Construct result set. * * @param SQLite3Result $result * SQLITE3 result object. */ public function __construct(\SQLite3Result $result) { $this->result = $result; while ($row = $result->fetchArray(SQLITE3_BOTH)) { $this->allRows[] = $row; } }
/** * @param \SQLite3Result $result */ private function fetch($result) { $retval = array(); while ($row = $result->fetchArray()) { $retval[] = $row; } return $retval; }
public function valid() { $this->_job = $this->_jobSqlResult->fetchArray(SQLITE3_ASSOC); if ($this->_job) { return true; } else { return false; } }
/** * Fetch rows of query result as associative array * * @param string $query * @param string $valueAsArrayIndex If not null you need to define a field name of the table * e.g. your table has {id, name, email} fields, if you set it to 'name' the key of resulting * array is the value of the field 'name' * @return array[] */ public function fetchAsAssoc($query, $valueAsArrayIndex = null) { $fetch = array(); $this->query($query); while ($row = $this->lastResult->fetchArray(SQLITE3_ASSOC)) { if ($valueAsArrayIndex) { if (!isset($row[$valueAsArrayIndex])) { error("Field '{$valueAsArrayIndex}' does not exist in SQL Result"); } $fetch[$row[$valueAsArrayIndex]] = $row; } else { $fetch[] = $row; } } return $fetch; }
/** * {@inheritdoc} */ public function fetch($fetchStyle = null) { if (!$this->_result) { return null; } $fetchStyle = $fetchStyle ?: $this->_defaultFetchStyle; switch ($fetchStyle) { case PDO::FETCH_NUM: $row = $this->_result->fetchArray(\SQLITE3_NUM); break; case PDO::FETCH_ASSOC: $row = $this->_result->fetchArray(\SQLITE3_ASSOC); break; case PDO::FETCH_BOTH: $row = $this->_result->fetchArray(\SQLITE3_BOTH); break; default: throw new Exception("Unknown fetch type '{$fetchStyle}'"); } return $row ?: null; }
/** * 从sql查询的结果中获取一条数据 * * @param \SQLite3Result $res sql查询结果 * @return array 获取的数据,或者false */ protected function _fetch($res) { return $res->fetchArray(MYSQLI_ASSOC); }
public function fetchAssoc(\SQLite3Result $result = null) { if ($this->dbHandle == null) { return false; } return $result->fetchArray(SQLITE3_ASSOC); }
/** * Number of rows in a result * * @param SQLite3Result $result * @return integer */ public function num_rows($result) { return count($result->fetchArray()); }
/** * Number of rows in a result. * * @param SQLite3Result $result * @return integer */ public function numRows($result) { !isset($result->fetchedByPMF) || !$result->fetchedByPMF || die("Do not call numRows() after you've fetched one or more result records, because PMF_DB_Sqlite3::numRows() has to reset the resultset at its end."); $numberOfRows = 0; while ($result->fetchArray(SQLITE3_NUM)) { $numberOfRows++; } $result->reset(); return $numberOfRows; }
function fetchArray($resultType = self::FETCH_ASSOC) { return $this->result->fetchArray($resultType); }
/** * @param \SQLite3Result $result * @return array */ protected function convertResultToArray(\SQLite3Result $result) { $results = array(); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $results[] = $row; } return $results; }
/** * Convert a result object to array of associative arrays. * * @param \SQLite3Result * @return array */ protected function resultToArray(\SQLite3Result $result) { $tags = array(); while ($tag = $result->fetchArray(SQLITE3_ASSOC)) { $tags[] = $tag; } return $tags; }
/** * @param SQLite3Result $result * @param int $mode * @return mixed */ public function fetch_array($result, $mode = self::RESULT_NUM) { return $result->fetchArray($mode); }