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


PHP dba_nextkey函数代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: nextkey

 public function nextkey()
 {
     return dba_nextkey($this->handle);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:4,代码来源:DBA.php

示例8: 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

示例9: 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

示例10: 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

示例11: clearByPrefix

 /**
  * Remove items matching given prefix
  *
  * @param string $prefix
  * @return boolean
  */
 public function clearByPrefix($prefix)
 {
     $options = $this->getOptions();
     $prefix = $options->getNamespace() . $options->getNamespaceSeparator() . $prefix;
     $prefixl = strlen($prefix);
     $result = true;
     $this->_open();
     do {
         // Workaround for PHP-Bug #62491 & #62492
         $recheck = false;
         $internalKey = dba_firstkey($this->handle);
         while ($internalKey !== false && $internalKey !== null) {
             if (substr($internalKey, 0, $prefixl) === $prefix) {
                 $result = dba_delete($internalKey, $this->handle) && $result;
                 $recheck = true;
             }
             $internalKey = dba_nextkey($this->handle);
         }
     } while ($recheck);
     return $result;
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:27,代码来源:Dba.php

示例12: list_keys

function list_keys()
{
    $res = array();
    if (!($id = dba_open(FILEDB_PATH, "wd", FILEDB_HANDLER))) {
        return ERROR;
    }
    for ($key = dba_firstkey($id); $key != false; $key = dba_nextkey($id)) {
        array_push($res, array($key, dba_fetch($key, $id)));
    }
    dba_close($id);
    return $res;
}
开发者ID:sohgo,项目名称:faxocr,代码行数:12,代码来源:common.php

示例13: parse_userauthdb

function parse_userauthdb($path, $uuid = null, $asmeta = false)
{
    $unix = new unix();
    $f = array();
    if ($GLOBALS["VERBOSE"]) {
        echo "Parsing {$path}\n";
    }
    if (!is_file($path)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$path} no such file\n";
        }
        return;
    }
    $db_con = dba_open($path, "r", "db4");
    if (!$db_con) {
        if ($asmeta) {
            meta_admin_mysql(1, "DB open failed {$path}", null, __FILE__, __LINE__);
        }
        echo "DB open failed\n";
        die;
    }
    $mainkey = dba_firstkey($db_con);
    while ($mainkey != false) {
        $val = 0;
        $array = unserialize(dba_fetch($mainkey, $db_con));
        $mac = $array["MAC"];
        if (strlen($mac) > 17) {
            $mac = clean_mac($mac);
        }
        $ipaddr = $array["IPADDR"];
        $uid = $array["uid"];
        $hostname = $array["hostname"];
        $UserAgent = $array["UserAgent"];
        $UserAgent = mysql_escape_string2($UserAgent);
        $uid = mysql_escape_string2($uid);
        $ipaddr = mysql_escape_string2($ipaddr);
        $mac = mysql_escape_string2($mac);
        $f[] = "('{$mainkey}','{$mac}','{$ipaddr}','{$uid}','{$hostname}','{$UserAgent}')";
        $mainkey = dba_nextkey($db_con);
    }
    dba_close($db_con);
    if (count($f) > 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "UserAutDB: INSERTING " . count($f) . " elements\n";
        }
        $q = new mysql_squid_builder();
        if ($uuid != null) {
            $q = new mysql_stats($uuid);
        }
        $sql = "INSERT IGNORE INTO UserAutDB (zmd5,MAC,ipaddr,uid,hostname,UserAgent) VALUES " . @implode(",", $f);
        $q->QUERY_SQL("TRUNCATE TABLE `UserAutDB`");
        $q->QUERY_SQL($sql);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:54,代码来源:exec.squid.stats-appliance-parse-dbs.php

示例14: GetAllWikiPagenames

function GetAllWikiPagenames($dbi)
{
    $namelist = array();
    $ctr = 0;
    $namelist[$ctr] = $key = dba_firstkey($dbi);
    while ($key = dba_nextkey($dbi)) {
        $ctr++;
        $namelist[$ctr] = $key;
    }
    return $namelist;
}
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:11,代码来源:dbalib.php

示例15: ParseFile

function ParseFile($tgz)
{
    $mysql = new mysql();
    if (!preg_match("#^(.+?)-[0-9]+-artica-php#", basename($tgz), $re)) {
        meta_events("Unable to find uuid in {$tgz}");
        return false;
    }
    $uuid = $re[1];
    $f = array();
    $GLOBALS["UUIDS"][$uuid] = true;
    $q = new mysql_uuid_meta($uuid);
    $tmpfile = $GLOBALS["CLASS_UNIX"]->FILE_TEMP() . ".db";
    $unix = new unix();
    if (!$unix->uncompress($tgz, $tmpfile)) {
        @unlink($tmpfile);
        meta_events("{$GLOBALS["UNCOMPRESSLOGS"]}");
        @unlink($tgz);
        return false;
    }
    $db_con = @dba_open($tmpfile, "r", "db4");
    if (!$db_con) {
        meta_events("Warning! DB open {$tmpfile} failed...");
        return false;
    }
    $mainkey = dba_firstkey($db_con);
    $c = 0;
    $n = 0;
    while ($mainkey != false) {
        $data = dba_fetch($mainkey, $db_con);
        $Array = unserialize($data);
        if (!is_array($Array)) {
            meta_events("{$mainkey} -> {$data} not an array...");
            $mainkey = dba_nextkey($db_con);
            continue;
        }
        $md5 = md5(serialize($Array));
        $date = $Array["DATE"];
        $time = strtotime($date);
        $xtime = date("Y-m-d H:i:s", $time);
        $hits = $Array["HITS"];
        $size = $Array["SIZE"];
        $mac = $Array["MAC"];
        $uid = $Array["UID"];
        $ipaddr = $Array["IPADDR"];
        $website = $Array["website"];
        $tablename = "squid_hourly_" . date("YmdH", $time);
        $f[$tablename][] = "('{$md5}','{$xtime}','{$website}','{$mac}','{$uid}','{$ipaddr}','{$hits}','{$size}')";
        if (count($f[$tablename]) > 2000) {
            meta_events("{$tablename} -> " . count($f[$tablename]));
            $prefix = "INSERT IGNORE INTO `{$tablename}` (`zdm5`,`zDate`,`sitename`,`mac`,`uid`,`ipaddr`,`hits`,`size`) VALUES ";
            if (!$q->create_squid_hourly($tablename)) {
                return false;
            }
            $q->QUERY_SQL($prefix . @implode(",", $f[$tablename]));
            if (!$q->ok) {
                meta_events($q->mysql_error);
                return false;
            }
            $f[$tablename] = array();
        }
        $mainkey = dba_nextkey($db_con);
    }
    if (count($f) > 0) {
        while (list($tablename, $rows) = each($f)) {
            meta_events("{$tablename} -> " . count($rows));
            $prefix = "INSERT IGNORE INTO `{$tablename}` (`zmd5`,`zDate`,`sitename`,`mac`,`uid`,`ipaddr`,`hits`,`size`) VALUES ";
            if (!$q->create_squid_hourly($tablename)) {
                return false;
            }
            $q->QUERY_SQL($prefix . @implode(",", $rows));
            if (!$q->ok) {
                meta_events($q->mysql_error);
                return false;
            }
        }
    }
    return true;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:78,代码来源:exec.artica-meta-squid-parser.php


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