adodb / adodblite and general sql question
Posted: Tue Jan 09, 2007 1:17 pm
I have always used the REPLACE statement for replacing data in a mysql database, but to my knowledge, that is not available in other databases... so, I am now using adodb-lite, and I need to know... what do I do to get the same functionality, but without limiting myself to just mysql?
Are there comparable methods in other dbs?
Is this what people do?
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;
}