一个访问ACCESS的类
时间:2007-12-23 来源:不详 作者:迈克DB
$this->close_dbm($dbm);
return false;
}
}
else
{
$this->close_dbm($dbm);
$removed = true;
}
}
else
{
$this->error = "key [$key] does not exist";
$this->close_dbm($dbm);
return false;
}
return true;
}
// *******************************************************
function get_value ($key)
{
$val = "";
$readonly = true;
$dbm = $this->open_dbm($readonly);
if(!$dbm) { return false; }
if(dbmexists($dbm,$key))
{
$val = dbmfetch($dbm,$key);
}
$this->close_dbm($dbm);
return $val;
}
// *******************************************************
function open_dbm ($readonly = false) 内容来自dedecms
{
global $php_errormsg;
if($this->static)
{
if(!(empty($this->dbm)))
{
$dbm = $this->dbm;
return ($dbm);
}
}
$filename = $this->file;
if(!$this->exists)
{
$dbm = @dbmopen($filename,"n");
}
else
{
if(!$readonly)
{
// we want the warning here if we can't be
// a writer
$dbm = dbmopen($filename,"w");
}
else
{
$dbm = @dbmopen($filename,"r");
}
}
if( (!$dbm) or (empty($dbm)) )
{
$this->exists = false;
$this->static = false;
$this->error = "unable to open [$filename] [$php_errormsg]";
织梦内容管理系统
return false;
}
$this->exists = true;
if($this->static)
{
$this->dbm = $dbm;
}
return ($dbm);
}
// *******************************************************
function find_key ($search)
{
$val = "";
$dbm = $this->open_dbm(1);
if(!$dbm) { return false; }
if(dbmexists($dbm,$search))
{
// wow an exact match
$val = dbmfetch($dbm,$search);
$this->close_dbm($dbm);
$this->exact = true;
return $val;
}
else
{
$this->exact = false;
$key = dbmfirstkey($dbm);
while ($key)
{

文章评论
共有位Admini5网友发表了评论 查看完整内容