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


PHP dba_fetch函数代码示例

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


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

示例1: __get

 public function __get($name)
 {
     $db = dba_open($this->filePath, 'wl', 'db4');
     $value = dba_exists($name, $db) ? dba_fetch($name, $db) : null;
     dba_close($db);
     return $value;
 }
开发者ID:sh9zad,项目名称:BerkeleyDBChecker,代码行数:7,代码来源:BDBConnector.php

示例2: AHZ2PY

 /**
  * 获取字符串可能的拼音列表
  *
  * @return array
  */
 public static function AHZ2PY($sHz, $sDbFile, $iFlag = self::FULL, $sHandler = 'cdb', $iMaxLen = 0)
 {
     if (!$iMaxLen) {
         $iMaxLen = self::DEFAULT_MAX_HZ2PYLEN;
     }
     $db = self::_HGetDbHandler($sDbFile, $sHandler);
     $len = min($iMaxLen, mb_strlen($sHz, 'UTF-8'));
     $arr = array();
     for ($i = 0; $i < $len; ++$i) {
         $char = mb_substr($sHz, $i, 1, 'UTF-8');
         if (false !== ($value = dba_fetch($char, $db)) && false !== ($value = unserialize($value))) {
             $arr[] = $value;
         } else {
             $arr[] = array(array($char, $char, ''));
         }
     }
     switch ($iFlag) {
         case self::BRIEF:
             $ret = self::_AMergePy('', $arr, $len, 0, self::BRIEF);
             break;
         case self::FULL_BRIEF:
             $ret = array_merge(self::_AMergePy('', $arr, $len, 0, self::FULL), self::_AMergePy('', $arr, $len, 0, self::BRIEF));
             break;
         case self::BRIEF_FULL:
             $ret = array_merge(self::_AMergePy('', $arr, $len, 0, self::BRIEF), self::_AMergePy('', $arr, $len, 0, self::FULL));
             break;
         default:
             $ret = self::_AMergePy('', $arr, $len, 0, self::FULL);
             break;
     }
     return array_values(array_unique($ret));
 }
开发者ID:AllenLyu,项目名称:ko,代码行数:37,代码来源:Pinyin.php

示例3: getcomments

function getcomments($m)
{
    global $xmlrpcerruser;
    $err = "";
    $ra = array();
    // get the first param
    if (XMLRPC_EPI_ENABLED == '1') {
        $msgID = xmlrpc_decode($m->getParam(0));
    } else {
        $msgID = php_xmlrpc_decode($m->getParam(0));
    }
    $dbh = dba_open("/tmp/comments.db", "r", "db2");
    if ($dbh) {
        $countID = "{$msgID}_count";
        if (dba_exists($countID, $dbh)) {
            $count = dba_fetch($countID, $dbh);
            for ($i = 0; $i < $count; $i++) {
                $name = dba_fetch("{$msgID}_name_{$i}", $dbh);
                $comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
                // push a new struct onto the return array
                $ra[] = array("name" => $name, "comment" => $comment);
            }
        }
    }
    // if we generated an error, create an error return response
    if ($err) {
        return new xmlrpcresp(0, $xmlrpcerruser, $err);
    } else {
        // otherwise, we create the right response
        // with the state name
        return new xmlrpcresp(php_xmlrpc_encode($ra));
    }
}
开发者ID:partisan-collective,项目名称:partisan,代码行数:33,代码来源:discuss.php

示例4: getComments

function getComments($req)
{
    $err = "";
    $ra = array();
    $encoder = new PhpXmlRpc\Encoder();
    $msgID = $encoder->decode($req->getParam(0));
    $dbh = dba_open("/tmp/comments.db", "r", "db2");
    if ($dbh) {
        $countID = "{$msgID}_count";
        if (dba_exists($countID, $dbh)) {
            $count = dba_fetch($countID, $dbh);
            for ($i = 0; $i < $count; $i++) {
                $name = dba_fetch("{$msgID}_name_{$i}", $dbh);
                $comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
                // push a new struct onto the return array
                $ra[] = array("name" => $name, "comment" => $comment);
            }
        }
    }
    // if we generated an error, create an error return response
    if ($err) {
        return new PhpXmlRpc\Response(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser, $err);
    } else {
        // otherwise, we create the right response
        return new PhpXmlRpc\Response($encoder->encode($ra));
    }
}
开发者ID:TsobuEnterprise,项目名称:phpxmlrpc,代码行数:27,代码来源:discuss.php

示例5: HIT

 function HIT($id)
 {
     $key = "{$id}.1";
     if ($r = unserialize(gzuncompress(dba_fetch($key, $this->handle)))) {
         $r["hits"] += 1;
         dba_replace($key, gzcompress(serialize($r), $this->gz), $this->handle);
     }
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:8,代码来源:dba.php

示例6: more

 function more()
 {
     if ($this->obj->db && $this->key !== false) {
         $this->val = dba_fetch($this->key, $this->obj->db);
         return true;
     } else {
         return false;
     }
 }
开发者ID:SandyS1,项目名称:presentations,代码行数:9,代码来源:spl.php

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

示例8: unserialize

 function &get($key)
 {
     if ($this->_data[$key] === true) {
         $this->_swap();
         $this->_disk--;
         $value = unserialize(dba_fetch($key, $this->_db));
         return $value;
     }
     return $this->_data[$key];
 }
开发者ID:rosarion,项目名称:php-hadoop,代码行数:10,代码来源:mem-file.php

示例9: isTrusted

	function isTrusted( $ip ) {
		$cdb = $this->getCdbHandle();
		// Try single host
		$hex = IP::toHex( $ip );
		$data = dba_fetch( $hex, $cdb );
		if ( $data ) {
			return true;
		}
		// TODO: IPv6 prefixes which aren't feasible to expand
		return false;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:11,代码来源:TrustedXFF.php

示例10: lookup_token

 function lookup_token($consumer, $token_type, $token) {/*{{{*/
   $rv = dba_fetch("${token_type}_${token}", $this->dbh);
   if ($rv === FALSE) {
     return NULL;
   }
   $obj = unserialize($rv);
   if (!($obj instanceof OAuthToken)) {
     return NULL;
   }
   return $obj;
 }/*}}}*/
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:11,代码来源:SimpleOAuthDataStore.php

示例11: lookup_token

 function lookup_token($consumer, $token_type, $token)
 {
     $rv = dba_fetch("{$token_type}_{$token}", $this->dbh);
     if ($rv === FALSE) {
         return NULL;
     }
     $obj = unserialize($rv);
     if (!$obj instanceof OAuthToken) {
         return NULL;
     }
     return $obj;
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:12,代码来源:SimpleOAuthDataStore.class.php

示例12: lookupToken

 function lookupToken($consumer, $tokenType, $token)
 {
     $rv = dba_fetch("{$tokenType}_{$token}", $this->dbh);
     if ($rv === false) {
         return null;
     }
     $obj = unserialize($rv);
     if (!$obj instanceof \OAuth\Token) {
         return null;
     }
     return $obj;
 }
开发者ID:nicokaiser,项目名称:php-oauth,代码行数:12,代码来源:SimpleOAuthDataStore.php

示例13: fetch

 public function fetch($key, &$value, $timeout_version = null)
 {
     $store = dba_fetch($this->create_key($key), $this->rs);
     $store = unserialize($store);
     if ($store !== false && $timeout_version < $store['dateline']) {
         if ($store['ttl'] > 0 && $store['dateline'] + $store['ttl'] < time()) {
             return false;
         }
         $value = $store['value'];
         return true;
     }
     return false;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:13,代码来源:dba.php

示例14: fetch

 public function fetch($key, &$value, $timeout_version = null)
 {
     $rs = dba_open(DATA_DIR . '/kvstore/dba.db', 'r-', $this->handle);
     $store = dba_fetch($this->create_key($key), $rs);
     dba_close($rs);
     $store = unserialize($store);
     if ($store !== false && $timeout_version < $store['dateline']) {
         if ($store['ttl'] > 0 && $store['dateline'] + $store['ttl'] < time()) {
             return false;
         }
         $value = $store['value'];
         return true;
     }
     return false;
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:15,代码来源:dba.php

示例15: get

 public function get($request)
 {
     if (is_array($request)) {
         $result = array();
         foreach ($request as $k) {
             $v = $this->get($k);
             if ($v === NULL) {
                 continue;
             }
             $result[$k] = $v;
         }
         return $result;
     }
     $v = dba_fetch($request, $this->handle);
     if ($v === NULL || $v === FALSE) {
         return NULL;
     }
     return $this->s->unserialize($v);
 }
开发者ID:Gaia-Interactive,项目名称:gaia_core_php,代码行数:19,代码来源:dba.php


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