一个访问ACCESS的类
时间:2007-12-23 来源:不详 作者:迈克DB
这是access的类
<?
class accessdbm
{
var $count = 0;
var $values = array();
var $file = "";
var $error = "";
var $exists = false;
var $static = false;
var $exact = false;
var $dbm;
// older version of php can't do the 'new classname(args)'
// use initilize() if this is the case.
// *******************************************************
function accessdbm ($dbmfile, $static = 0)
{
global $php_errormsg;
if(!empty($dbmfile))
{
if(file_exists($dbmfile))
{
$this->exists = true;
}
if($static != 0)
{
$this->static = true;
}
$this->file = $dbmfile; 本文来自织梦
}
return;
}
// *******************************************************
// identical to accessdbm
function initialize ($dbmfile, $static = 0)
{
global $php_errormsg;
if(!empty($dbmfile))
{
if(file_exists($dbmfile))
{
$this->exists = true;
}
if($static != 0)
{
$this->static = true;
}
$this->file = $dbmfile;
}
return;
}
// *******************************************************
function add_entry ($key, $val)
{
$results = 0;
$dbm = $this->open_dbm();
if(!$dbm) { return false; }
if(!(dbmreplace($dbm,$key,$val)))
{
if(!(dbmexists($dbm,$key)))
{
dedecms.com
$this->error = "fatal error : could not replace $key with $val";
$this->close_dbm($dbm);
return false;
}
}
$this->close_dbm($dbm);
return true;
}
// *******************************************************
function remove_entry ($key)
{
global $php_errormsg;
$removed = false;
$dbm = $this->open_dbm();
if(!$dbm) { return false; }
if(dbmexists($dbm,$key))
{
if(!dbmdelete($dbm,$key))
{
if(dbmexists($dbm,$key))
{
$this->error = "unable to remove [$key] : [$php_errormsg]";
文章评论
共有位Admini5网友发表了评论 查看完整内容