當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Db::lastInsertId方法代碼示例

本文整理匯總了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;
 }
開發者ID:joerch,項目名稱:PHProjekt,代碼行數:15,代碼來源:DbParser.php

示例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));
     }
 }
開發者ID:appsoluut,項目名稱:MiniThor-core,代碼行數:20,代碼來源:PowerDNS.php

示例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();
 }
開發者ID:jfro,項目名稱:php-simpledb,代碼行數:24,代碼來源:Item.php


注:本文中的Zend_Db::lastInsertId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。