当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Db_Table_Abstract::insert方法代码示例

本文整理汇总了PHP中Zend_Db_Table_Abstract::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::insert方法的具体用法?PHP Zend_Db_Table_Abstract::insert怎么用?PHP Zend_Db_Table_Abstract::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Db_Table_Abstract的用法示例。


在下文中一共展示了Zend_Db_Table_Abstract::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update($id, $state, $info)
 {
     $data = array('state' => $state, 'info' => $info, 'lastupdate' => time());
     $found = $this->find($id);
     if ($found) {
         $data = array_merge($found, $data);
         unset($data['id']);
         $this->dbTable->update($data, array('id = ?' => $id));
     } else {
         $data['id'] = $id;
         $data['sticked'] = 0;
         $this->dbTable->insert($data);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:14,代码来源:Mapper.php

示例2: insert

 /**
  * Insert
  *
  * Calculates a unique ID and commits the new data
  * 
  * @param  array $data 
  * @return string
  */
 public function insert(array $data)
 {
     $adapter = $this->getAdapter();
     $adapter->beginTransaction();
     do {
         $uniqId = uniqid();
         $select = $adapter->select()->from($this->_name, 'COUNT(*)')->where('id = ?', $uniqId);
         $found = $adapter->fetchOne($select);
     } while ($found > 0);
     $data['id'] = $uniqId;
     $data['created'] = date('Y-m-d H:i:s');
     $created = strtotime($data['created']);
     if (array_key_exists('expires', $data) && (is_int($data['expires']) || $data['expires'] == intval($data['expires']))) {
         $expires = $data['expires'];
         if (0 < $expires && $expires < $created) {
             $data['expires'] = date('Y-m-d H:i:s', $created + $expires);
         }
     } elseif (array_key_exists('expires', $data) && is_string($data['expires'])) {
         $expires = strtotime($data['expires']);
         if (0 < $expires && $expires < $created) {
             unset($data['expires']);
         }
     } elseif (array_key_exists('expires', $data)) {
         unset($data['expires']);
     }
     parent::insert($data);
     $adapter->commit();
     return $uniqId;
 }
开发者ID:jesus12223,项目名称:pastebin,代码行数:37,代码来源:Paste.php

示例3: insert

 public function insert(array $data)
 {
     if (empty($data['created_at'])) {
         $data['created_at'] = new Zend_Db_Expr('NOW()');
     }
     return parent::insert($data);
 }
开发者ID:wangshipeng,项目名称:Php-Online,代码行数:7,代码来源:BaseModel.php

示例4: insert

 public function insert($feedbackdata)
 {
     $data['name'] = $feedbackdata['name'];
     $data['email'] = $feedbackdata['email'];
     $data['message'] = $feedbackdata['message'];
     return parent::insert($data);
 }
开发者ID:relyd,项目名称:aidstream,代码行数:7,代码来源:Contact.php

示例5: insert

 /**
  * Make sure the created timestamp is always set
  *
  * @param  array &$data
  * @return integer
  */
 public function insert(&$data)
 {
     if (!isset($data['created'])) {
         $data['created'] = time();
     }
     return parent::insert($data);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:Message.php

示例6: insert

 public function insert(array $data)
 {
     $data['dateins'] = date('Y-m-d H:i:s');
     $data['dateco'] = date('Y-m-d H:i:s');
     $data['IP'] = $_SERVER["REMOTE_ADDR"];
     return parent::insert($data);
 }
开发者ID:smehtaAA,项目名称:projectlag,代码行数:7,代码来源:Compte.php

示例7: saveSupportRequest

 public function saveSupportRequest($data)
 {
     $input['name'] = $data['support_name'];
     $input['email'] = $data['support_email'];
     $input['query'] = $data['support_query'];
     return parent::insert($input);
 }
开发者ID:relyd,项目名称:aidstream,代码行数:7,代码来源:Support.php

示例8: insert

 public function insert(array $data)
 {
     $date = new Zend_Date();
     $data['datebug'] = $date->toString('Y-MM-d');
     $data['statut'] = "Non lu";
     return parent::insert($data);
 }
开发者ID:smehtaAA,项目名称:projectlag,代码行数:7,代码来源:Bug.php

示例9: insert

 public function insert(array $data)
 {
     require_once 'models/Session.php';
     $data['timestamp_created'] = new Zend_Db_Expr('NOW()');
     $data['created_by'] = Session::getCurrentUserId();
     //don't set is_deleted
     return Zend_Db_Table_Abstract::insert($data);
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:8,代码来源:MultiAssignList.php

示例10: insert

 public function insert(array $data)
 {
     if (empty($data['guid'])) {
         $guidMan = new Pandamp_Core_Guid();
         $data['guid'] = $guidMan->generateGuid();
     }
     return parent::insert($data);
 }
开发者ID:hukumonline,项目名称:quart80,代码行数:8,代码来源:Poll.php

示例11: insert

 /**
  * Add user_id to insert query.
  */
 public function insert(array $params)
 {
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $params['user_id'] = $identity->id;
     $params['created'] = new Zend_Db_Expr('NOW()');
     return parent::insert($params);
 }
开发者ID:vishaleyes,项目名称:cookingwithzend,代码行数:11,代码来源:Rating.php

示例12: insert

 public function insert(array $data)
 {
     $data['date_s'] = date('Y-m-d H:i:s');
     $data['vu'] = 0;
     $data['visible'] = 1;
     $data['IP'] = $_SERVER["REMOTE_ADDR"];
     return parent::insert($data);
 }
开发者ID:smehtaAA,项目名称:projectlag,代码行数:8,代码来源:Sujet.php

示例13: insert

 public function insert($data)
 {
     $extra = $this->_getExtraValues($data);
     $string = $this->_encodeExtraValues($extra);
     $data = $this->_getMainValues($data);
     $data[self::TABLE_COLUMN_NAME_EXTRAVALUES] = $string;
     return parent::insert($data);
 }
开发者ID:justinwoods,项目名称:Church-Video-Models,代码行数:8,代码来源:Log.php

示例14: _insert

 /**
  * insert row into DB
  *
  * @param array $data ''
  * @return void
  * @throws Zend_Exception if row cannot be inserted
  */
 private function _insert($data)
 {
     try {
         $this->obj->insert($data);
     } catch (\Zend_Exception $e) {
         throw $e;
     }
 }
开发者ID:lagged,项目名称:zf_crud,代码行数:15,代码来源:Controller.php

示例15: insert

 /**
  * Вставляет новую строку в таблицу.
  * Все значения '' (пустая строка) в массиве $data заменяются на null.
  *
  * @param  array $data Массив пар "поле => значение".
  * @return mixed Значение первичного ключа вставленной строки.
  */
 public function insert(array $data)
 {
     if ($keys = array_keys($data, '')) {
         foreach ($keys as $key) {
             $data[$key] = null;
         }
     }
     return parent::insert($data);
 }
开发者ID:ROLF-IT-Department,项目名称:rolf-personnel,代码行数:16,代码来源:Abstract.php


注:本文中的Zend_Db_Table_Abstract::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。