function fetch_single($resId = null, $result_type = SQLITE_BOTH)
 {
     if ($resId == null) {
         $resId = $this->resId;
     }
     if (DEBUG) {
         $out = sqlite_fetch_string($resId, $result_type);
     } else {
         $out = @sqlite_fetch_string($resId, $result_type);
     }
     return $out;
 }
Example #2
0
function sqlitem_fetch_string($result, $result_type = SQLITE_BOTH)
{
    return sqlite_fetch_string($result, $result_type);
}
Example #3
0
 function getValue($resultType = ANYDB_STRING)
 {
     $res = @sqlite_fetch_string($this->result);
     if (!$res) {
         $this->_addError('No result', 'getValue()');
         return false;
     }
     if ($resultType != ANYDB_STRING) {
         if (!@settype($res, $resultType)) {
             $this->_addError('Could not convert result', 'getValue()');
             return false;
         }
     }
     return $res;
 }
 function getValue()
 {
     return @sqlite_fetch_string($this->result);
 }
Example #5
0
 /** Checks if data associated with a hash is expired.
  *
  * @param	string	$hash	The hash of the entry to be checked.
  * @return	boolean			true if the entry is expired, otherwise false.
  * @access	public
  */
 public function isExpired($hash)
 {
     $result = sqlite_query($this->sqlite, "SELECT expiration FROM cache WHERE hash = '" . sqlite_escape_string($hash) . "'");
     $expiration = sqlite_fetch_string($result);
     return time() > intval($expiration);
 }
Example #6
0
 /**
  * レコードの先頭1カラム目をすべて取得する。
  *
  * @param Resource	$result	クエリの結果セット。
  * @return	array(mixed)
  */
 function fetchsinglearray($result)
 {
     $ret = array();
     while (($str = sqlite_fetch_string($result)) !== false) {
         $ret[] = $str;
     }
     if (get_magic_quotes_runtime()) {
         return array_map('stripslashes', $ret);
     }
     return $ret;
 }
Example #7
0
    }
    // columns
    sqlite_seek($rh, 2);
    for ($i = 0; $i < sqlite_num_fields($rh); $i++) {
        $n = sqlite_field_name($rh, $i);
        $c = sqlite_column($rh, $i);
        var_dump($c);
        $c = sqlite_column($rh, $n);
        var_dump($c);
    }
    // fetch_all
    $r = sqlite_fetch_all($rh);
    var_dump($r);
    // fetch single
    sqlite_rewind($rh);
    $r = sqlite_fetch_string($rh);
    var_dump($r);
} else {
    echo "bad query: " . sqlite_error_string($db);
}
// array_query
$val = sqlite_array_query($db, 'SELECT * FROM mytable');
var_dump($val);
// single query
$val = sqlite_single_query($db, 'SELECT * FROM mytable');
var_dump($val);
$val = sqlite_single_query($db, 'SELECT * FROM mytable LIMIT 1', true);
var_dump($val);
$val = sqlite_single_query($db, 'SELECT * FROM mytable LIMIT 1', false);
var_dump($val);
$r = sqlite_close($db);