本文整理汇总了PHP中Varien_Db_Adapter_Interface::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Adapter_Interface::insert方法的具体用法?PHP Varien_Db_Adapter_Interface::insert怎么用?PHP Varien_Db_Adapter_Interface::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Db_Adapter_Interface
的用法示例。
在下文中一共展示了Varien_Db_Adapter_Interface::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _moveAttributesData
/**
* @param Mage_Customer_Model_Customer $customer
*/
protected function _moveAttributesData($customer)
{
$attributes = array('po_limit' => $this->_poLimitId, 'po_credit' => $this->_poCreditId);
foreach ($attributes as $attributeCode => $attributeId) {
try {
$select = $this->_db->select()->from($customer->getResource()->getTable('customer_entity_int'), array('value'))->where('attribute_id = ?', $attributeId)->where('entity_id = ?', $customer->getId());
$value = $this->_db->fetchOne($select);
if ((int) $value > 0) {
$this->_db->insert($customer->getResource()->getTable('customer_entity_decimal'), array('entity_type_id' => $customer->getEntityTypeId(), 'attribute_id' => $attributeId, 'entity_id' => $customer->getId(), 'value' => (int) $value));
}
} catch (Exception $e) {
}
try {
$this->_db->delete($customer->getResource()->getTable('customer_entity_int'), 'entity_type_id = ' . $customer->getEntityTypeId() . ' AND attribute_id = ' . $attributeId . ' AND ' . 'entity_id = ' . $customer->getId());
} catch (Exception $e) {
}
}
}
示例2: 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;
}
示例3: 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;
}
示例4: markEntityProcessed
/**
* Mark entity as processed
*
* @param $type
* @param $id
* @return int
*/
function markEntityProcessed($type, $id)
{
return $this->_connection->insert($this->getEntityMigrationTable($type), array('id' => $id));
}