本文整理汇总了PHP中Zend_Db::lastInsertId方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db::lastInsertId方法的具体用法?PHP Zend_Db::lastInsertId怎么用?PHP Zend_Db::lastInsertId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db
的用法示例。
在下文中一共展示了Zend_Db::lastInsertId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getModuleId
/**
* Return the ID of the module in the module table.
*
* @param string $module Name of the module.
*
* @return integer The module ID.
*/
private function _getModuleId($module)
{
$moduleId = $this->_moduleRow($module, 'id');
if ($moduleId == 0) {
$moduleId = $this->_db->lastInsertId($module, 'id');
}
return $moduleId;
}
示例2: createZone
public function createZone($domain)
{
if ($this->getDomainId($domain) === false) {
// Zone doesn't exist yet
// Create entry in the 'domains' table
$this->_db->insert('domains', array('name' => $domain, 'type' => 'MASTER'));
$domainId = $this->_db->lastInsertId();
// Create entry in the 'zones' table using the just created domain id
$this->_db->insert('zones', array('domain_id' => $domainId, 'owner' => 2, 'comment' => 'Created by MiniThor-core'));
$this->addRecord($domainId, $domain, 'SOA', 'ns3.remorse.nl hostmaster.' . $domain . ' 0');
$this->addRecord($domainId, $domain, 'NS', 'ns3.remorse.nl');
$this->addRecord($domainId, $domain, 'NS', 'ns4.remorse.nl');
$this->addRecord($domainId, $domain, 'A', '83.96.134.196');
$this->addRecord($domainId, 'www.' . $domain, 'A', '83.96.134.196');
$this->addRecord($domainId, 'localhost.' . $domain, 'A', '127.0.0.1');
} else {
// Zone is already known by PowerDNS
throw new Exception(sprintf('Zone for "%s" already exists', $domain));
}
}
示例3: save
/**
* Saves the current attributes to the DB.
*/
public function save()
{
$this->beforeSave();
// Trims out non-fields and serializes data for DB entry.
$info = $this->info(true, true);
if (!$this->exists) {
$this->beforeCreate();
$this->_zendDb->insert($this->tableName(), $info);
if (!$this->id) {
$this->id = $this->_zendDb->lastInsertId();
}
$this->_afterCommand('insert');
$this->exists = true;
$this->afterCreate();
} else {
$this->_zendDb->update($this->tableName(), $info, 'id = ' . $this->_zendDb->quote($this->id));
$this->_afterCommand('update');
}
$this->afterSave();
$this->_lastSaveRow = $this->info();
}