<?PHP
class DAONewFile extends DAONewUfd
{
var $db;
var $db_table;
var $db_field;
function DAONewFile()
{
global $db, $db_table, $db_field;
$this->db = $db;
$this->db_table = $db_table;
$this->db_field = $db_field;
}
function newFile($_ufdobj)
{
$wfileobj = $_ufdobj->getobj();
$sqlq = "INSERT INTO `".$this->db_table['fileattr']."` (".
"`fullpath`, `filename`, `filesize`, ".
"`contenttype`, `location`, `status`, `temppass`)".
" VALUES ('".
$wfileobj->getfullpath()."', '".
$wfileobj->getfilename().
"', ".$wfileobj->getfilesize().", '".
$wfileobj->getcontenttype()."', '".
$wfileobj->getlocation()."', ".$wfileobj->getstatus()
.", '".$wfileobj->gettemppass()."')";
//echo $sqlq;
if ($this->db->sql_query($sqlq, BEGIN_TRANSACTION))
{
$NFileid = $this->db->sql_nextid();
if ($NFileid>0)
{
$wfileobj->setid($NFileid);
$_ufdobj->setobj($wfileobj);
$_ufdobj->setlinkid($NFileid);
$NUfdid = $this->newUfd($_ufdobj);
if ($NUfdid>0)
{
$_ufdobj->setid($NUfdid);
return $_ufdobj;
}
}
}
return null;
}
function updatePath($_wfile)
{
$sqlq = "UPDATE ".$this->db_table['fileattr']." SET ".
"location='".$_wfile->getlocation()."' WHERE ".
"id=".$_wfile->getid();
if ($this->db->sql_query($sqlq))
{
return true;
}
return false;
}
function rollback()
{
$this->db->sql_query("", ROLLBACK);
}
function commit()
{
$this->db->sql_query("", END_TRANSACTION);
}
}
?>