<?
class DbaWrapper
{
var $dbaId;
var $dbaFile;
var $dbaMode;
function DbaWrapper($file,$mode)
{
print "in";
$this->dbaId = dba_open("$file", "$mode", "db2");
if(!$this->dbaId)
{
die("Error!, could not stat dba $file");
}
$this->dbaFile = $file;
$this->dbaMode = $mode;
}
function fetch($key)
{
if(dba_exists("$key", $this->dbaId))
{
return dba_fetch("$key", $this->dbaId);
}
else
{
return false;
}
}
function insert($key,$value)
{
return dba_insert($key, $value, $this->dbaId);
}
function replace($key,$value)
{
return dba_replace($key, $value, $this->dbaId);
}
function optimize()
{
dba_optimize($this->dbaId);
dba_sync($this->dbaId);
}
function delete($key)
{
if(dba_exists("$key", $this->dbaId))
{
return dba_delete("$key", $this->dbaId);
}
else
{
return false;
}
}
function close()
{
if($this->dbaId)
{
@dba_close($this->dbaId);
}
}
}
?>