本文整理汇总了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;
}
示例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));
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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];
}
示例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;
}
示例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;
}/*}}}*/
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}