Esempio n. 1
1
 protected function db2Arr(SQLite3Result $data)
 {
     $arr = [];
     while ($row = $data->fetchArray(SQLITE3_ASSOC)) {
         $arr[] = $row;
     }
     return $arr;
 }
Esempio n. 2
0
 /**
  * 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;
     }
 }
 public function nextRecord()
 {
     if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
         return $data;
     } else {
         return false;
     }
 }
Esempio n. 4
0
 /**
  * @param \SQLite3Result $result
  */
 private function fetch($result)
 {
     $retval = array();
     while ($row = $result->fetchArray()) {
         $retval[] = $row;
     }
     return $retval;
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function columnCount()
 {
     if (!$this->_result) {
         return 0;
     }
     return $this->_result->numColumns();
 }
Esempio n. 6
0
 public function valid()
 {
     $this->_job = $this->_jobSqlResult->fetchArray(SQLITE3_ASSOC);
     if ($this->_job) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
 /**
  * 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;
 }
Esempio n. 8
0
 /**
  * 释放sql查询结果
  *
  * @param \SQLite3Result $res 要释放的结果
  * @return bool 成功返回true,失败返回false
  */
 protected function _free($res)
 {
     return $res->finalize();
 }
 public function fetchAssoc(\SQLite3Result $result = null)
 {
     if ($this->dbHandle == null) {
         return false;
     }
     return $result->fetchArray(SQLITE3_ASSOC);
 }
Esempio n. 10
0
 /**
  * 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;
 }
Esempio n. 12
0
 function fetchArray($resultType = self::FETCH_ASSOC)
 {
     return $this->result->fetchArray($resultType);
 }
Esempio n. 13
0
 /**
  * @param \SQLite3Result $result
  * @return array
  */
 protected function convertResultToArray(\SQLite3Result $result)
 {
     $results = array();
     while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
         $results[] = $row;
     }
     return $results;
 }
Esempio n. 14
0
 /**
  * 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;
 }
Esempio n. 15
-1
 /**
  * @param SQLite3Result $result
  * @param int $mode
  * @return mixed
  */
 public function fetch_array($result, $mode = self::RESULT_NUM)
 {
     return $result->fetchArray($mode);
 }