本文整理匯總了PHP中Varien_Db_Adapter_Interface::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Db_Adapter_Interface::update方法的具體用法?PHP Varien_Db_Adapter_Interface::update怎麽用?PHP Varien_Db_Adapter_Interface::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Db_Adapter_Interface
的用法示例。
在下文中一共展示了Varien_Db_Adapter_Interface::update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: write
/**
* Update session
*
* @param string $sessId
* @param string $sessData
* @return boolean
*/
public function write($sessId, $sessData)
{
$bindValues = array('session_id' => $sessId);
$select = $this->_write->select()->from($this->_sessionTable)->where('session_id = :session_id');
$exists = $this->_read->fetchOne($select, $bindValues);
$bind = array('session_expires' => time(), 'session_data' => $sessData);
if ($exists) {
$this->_write->update($this->_sessionTable, $bind, array('session_id=?' => $sessId));
} else {
$bind['session_id'] = $sessId;
$this->_write->insert($this->_sessionTable, $bind);
}
return true;
}
示例2: write
/**
* Update session
*
* @param string $sessionId
* @param string $sessionData
* @return boolean
*/
public function write($sessionId, $sessionData)
{
// need to use write connection to get the most fresh DB sessions
$bindValues = array('session_id' => $sessionId);
$select = $this->_write->select()->from($this->_sessionTable)->where('session_id = :session_id');
$exists = $this->_write->fetchOne($select, $bindValues);
// encode session serialized data to prevent insertion of incorrect symbols
$sessionData = base64_encode($sessionData);
$bind = array('session_expires' => time(), 'session_data' => $sessionData);
if ($exists) {
$this->_write->update($this->_sessionTable, $bind, array('session_id=?' => $sessionId));
} else {
$bind['session_id'] = $sessionId;
$this->_write->insert($this->_sessionTable, $bind);
}
return true;
}