Are there comparable methods in other dbs?
Is this what people do?
Code: Select all
public function write($id, $data)
{
$deleteQuery = "
DELETE FROM `" . $this->_sessionTable . "`
WHERE `" . $this->_sessionTable . "`.`id` = ?
";
$this->_db->execute($deleteQuery, array($id));
$insertQuery = "
INSERT INTO `" . $this->_sessionTable . "`
(id, user_id, user_ip, data, access)
VALUES (?, ?, ?, ?, ?)
";
$values = array(
$id,
$this->_userId,
$this->_remoteAddr,
$data,
time()
);
$result = $this->_db->execute($insertQuery, $values);
return $result;
}