当前位置: 首页>>代码示例>>PHP>>正文


PHP dba_firstkey函数代码示例

本文整理汇总了PHP中dba_firstkey函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_firstkey函数的具体用法?PHP dba_firstkey怎么用?PHP dba_firstkey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dba_firstkey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reset

 function reset()
 {
     if (!$this->obj->db) {
         return;
     }
     $this->key = dba_firstkey($this->obj->db);
 }
开发者ID:SandyS1,项目名称:presentations,代码行数:7,代码来源:spl.php

示例2: dba_fetch_assoc

function dba_fetch_assoc($handle)
{
    $assoc = array();
    for ($k = dba_firstkey($handle); $k != false; $k = dba_nextkey($handle)) {
        $assoc[$k] = dba_fetch($k, $handle);
        echo "\$k: {$k}, \$assoc[\$k]: " . $assoc[$k] . "\n";
    }
    return $assoc;
}
开发者ID:4v4t4r,项目名称:BroCTF,代码行数:9,代码来源:read-db.php

示例3: hasNext

 /**
  * Returns true if the iteration has more elements. (In other words, 
  * returns true if next would return an element rather than throwing 
  * an exception.)
  *
  * @return  bool
  */
 public function hasNext()
 {
     if (NULL === $this->_key) {
         // First call
         $this->_key = dba_firstkey($this->_fd);
     } else {
         // Subsequent calls
         $this->_key = dba_nextkey($this->_fd);
     }
     return is_string($this->_key);
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:18,代码来源:DBAIterator.class.php

示例4: process

 /**
  * Internal cleaning process.
  *
  * @param boolean $cleanAll
  *
  * @return void
  */
 protected function process($cleanAll = true)
 {
     $key = dba_firstkey($this->cache->getDba());
     while ($key !== false && $key !== null) {
         if (true === $cleanAll) {
             $this->cache->delete($key);
         } else {
             $this->cache->get($key);
         }
         $key = dba_nextkey($this->cache->getDba());
     }
     dba_optimize($this->cache->getDba());
 }
开发者ID:gjerokrsteski,项目名称:php-dba-cache,代码行数:20,代码来源:Sweep.php

示例5: getKeys

 public function getKeys()
 {
     $db = dba_open($this->filePath, 'wl', 'db4');
     $key = dba_firstkey($db);
     $keys_array = array();
     while ($key != false) {
         if (true) {
             // remember the key to perform some action later
             $keys_array[] = $key;
         }
         $key = dba_nextkey($db);
     }
     dba_close($db);
     return $keys_array;
 }
开发者ID:sh9zad,项目名称:BerkeleyDBChecker,代码行数:15,代码来源:BDBConnector.php

示例6: size

 /**
  * Calculates the size of the database in number of keys
  *
  * @access  public
  * @return  int    number of keys in the database
  */
 function size()
 {
     $key = dba_firstkey($this->_dba);
     $size = 0;
     while ($key !== false) {
         ++$size;
         $key = dba_nextkey($this->_dba);
     }
     return $size;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:16,代码来源:Builtin.php

示例7: dirname

<?php

$handler = 'cdb';
require_once dirname(__FILE__) . '/test.inc';
echo "Test 0\n";
if (($db_file = dba_open($db_filename, 'n', $handler)) !== FALSE) {
    var_dump(dba_insert("key1", "Content String 1", $db_file));
    var_dump(dba_replace("key1", "New Content String", $db_file));
    var_dump(dba_fetch("key1", $db_file));
    var_dump(dba_firstkey($db_file));
    var_dump(dba_delete("key1", $db_file));
    var_dump(dba_optimize($db_file));
    var_dump(dba_sync($db_file));
    dba_close($db_file);
} else {
    echo "Failed to open DB\n";
}
unlink($db_filename);
echo "Test 1\n";
if (($db_file = dba_open($db_filename, 'c', $handler)) !== FALSE) {
    dba_insert("key1", "Content String 1", $db_file);
    dba_close($db_file);
} else {
    echo "Failed to open DB\n";
}
echo "Test 2\n";
if (($db_file = dba_open($db_filename, 'r', $handler)) !== FALSE) {
    dba_insert("key1", "Content String 1", $db_file);
    dba_close($db_file);
} else {
    echo "Failed to open DB\n";
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_dba_tests_dba_cdb_001.php

示例8: ALLFILES

 function ALLFILES()
 {
     $id = dba_firstkey($this->handle);
     while ($id != false) {
         $p = strrpos($id, ".");
         $id = substr($id, 0, $p);
         $r[$id] = $id;
         $id = dba_nextkey($this->handle);
     }
     $r = array_values($r);
     return $r;
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:12,代码来源:dba.php

示例9: keys

 /**
  * Returns an array of keys
  *
  * Note: Do not use this for databases containing large amounts 
  * of keys, use the iterator() method instead.
  *
  * @return  string[] keys
  * @throws  io.IOException in case fetching the keys fails
  * @see     xp://io.dba.DBAFile#iterator
  */
 public function keys()
 {
     $keys = array();
     if (NULL === ($k = dba_firstkey($this->_fd))) {
         throw new IOException('Could not fetch first key');
     }
     while (is_string($k)) {
         $keys[] = $k;
         $k = dba_nextkey($this->_fd);
     }
     return $keys;
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:22,代码来源:DBAFile.class.php

示例10: firstkey

 function firstkey()
 {
     return dba_firstkey($this->_dbh);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:4,代码来源:DbaDatabase.php

示例11: HyperCacheSizeLog

function HyperCacheSizeLog($dbfile)
{
    $dbfile = "/usr/share/squid3/HyperCacheSizeLog.db";
    if (!is_file($dbfile)) {
        return;
    }
    $db_con = dba_open($path, "r", "db4");
    if (!$db_con) {
        return false;
    }
    $mainkey = dba_firstkey($db_con);
    while ($mainkey != false) {
        $val = 0;
        $array = unserialize(dba_fetch($mainkey, $db_con));
        $zDate = $mainkey;
        $mainkey = dba_nextkey($db_con);
        if (!is_array($data)) {
            continue;
        }
    }
    dba_close($db_con);
    $this->ok = true;
    return $wwwUH;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:24,代码来源:exec.squidcache.php

示例12: getAll

 public function getAll()
 {
     // reset cache
     $this->cache = [];
     $tmp = [];
     // read all
     for ($key = dba_firstkey($this->dbHandler); $key != false; $key = dba_nextkey($this->dbHandler)) {
         $v = dba_fetch($key, $this->dbHandler);
         // Convert
         $value = $this->decode($v);
         // Store
         $tmp[$key] = $value;
     }
     if ($this->useCache) {
         $this->cache = $tmp;
     }
     return $tmp;
 }
开发者ID:schpill,项目名称:thin,代码行数:18,代码来源:Dba.php

示例13: define

<?php

// xxx
// dump the dict.cdb to dict.txt
//
define("_WORD_ALONE_", 0x4000000);
define("_WORD_PART_", 0x8000000);
$db = dba_open("dict.cdb", "r", "cdb");
$total = 0;
if ($key = dba_firstkey($db)) {
    do {
        $value = (int) dba_fetch($key, $db);
        if (!($value & _WORD_ALONE_)) {
            continue;
        }
        $value &= ~(_WORD_ALONE_ | _WORD_PART_);
        echo "{$key}\t\t{$value}\r\n";
        $total++;
    } while ($key = dba_nextkey($db));
}
dba_close($db);
echo "# total {$total}\n";
开发者ID:lamphp,项目名称:scws,代码行数:22,代码来源:mk_txt.php

示例14: firstkey

 /**
  * Retrieves the first key in the database.
  * 
  * @access	public
  * @return	string
  * 
  */
 function firstkey()
 {
     return @dba_firstkey($this->connection);
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:11,代码来源:BDB.php

示例15: find_md5_loop

function find_md5_loop($filemd5)
{
    $dbfile = "{$GLOBALS["HyperCacheStoragePath"]}/cache.db";
    $db_con = @dba_open($dbfile, "r", "db4");
    if (!$db_con) {
        events("analyze:: FATAL!!!::{$dbfile}, unable to open");
        return null;
    }
    $mainkey = dba_firstkey($db_con);
    while ($mainkey != false) {
        $array = unserialize(dba_fetch($mainkey, $db_con));
        $keymd5 = $array["md5file"];
        if ($keymd5 == $filemd5) {
            $uri = $mainkey;
            @dba_close($db_con);
            return $uri;
        }
        $mainkey = dba_nextkey($db_con);
    }
    @dba_close($db_con);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:21,代码来源:squidcache.php


注:本文中的dba_firstkey函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。