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


PHP Zend_Db_Adapter_Abstract::update方法代码示例

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


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

示例1: update

 public function update(ActiveSync_Model_SyncState $_syncState)
 {
     $where = array($this->_db->quoteInto('device_id = ?', $_syncState->device_id), $this->_db->quoteInto('type = ?', $_syncState->type), $this->_db->quoteInto('counter = ?', $_syncState->counter));
     $newData = array('lastsync' => $_syncState->lastsync);
     $result = $this->_db->update(SQL_TABLE_PREFIX . 'acsync_synckey', $newData, $where);
     return $result;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:7,代码来源:SyncState.php

示例2: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($sourceId = null, $userId = null)
 {
     $now = new \MUtil_Db_Expr_CurrentTimestamp();
     $values = array('gso_last_synch' => $now, 'gso_changed' => $now, 'gso_changed_by' => $userId);
     $where = $this->db->quoteInto('gso_id_source = ?', $sourceId);
     $this->db->update('gems__sources', $values, $where);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:13,代码来源:UpdateSyncDate.php

示例3: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($lineNr = null, $forRoundOrder = null, $usesRoundRound = null, $roundField = null)
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     if (!(isset($import['trackId']) && $import['trackId'])) {
         // Do nothing
         return;
     }
     if (isset($import['roundOrders'][$usesRoundRound]) && $import['roundOrders'][$usesRoundRound]) {
         $this->db->update('gems__rounds', array($roundField => $import['roundOrders'][$usesRoundRound]), $this->db->quoteInto("gro_id_order = ? AND ", $forRoundOrder) . $this->db->quoteInto("gro_id_track = ?", $import['trackId']));
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:18,代码来源:UpdateRoundValidTask.php

示例4: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute()
 {
     $role = \Gems_Roles::getInstance();
     $parents = $this->db->fetchPairs("SELECT grl_id_role, grl_parents FROM gems__roles");
     // \MUtil_Echo::track($parents);
     if ($parents) {
         foreach ($parents as $id => $priv) {
             $values['grl_parents'] = implode(',', $role->translateToRoleIds($priv));
             $this->db->update('gems__roles', $values, $this->db->quoteInto('grl_id_role = ?', $id));
         }
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:18,代码来源:UpdateRoleIds.php

示例5: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($tableName = '', $idField = '', $passwordField = '', $methodField = '')
 {
     $passwords = $this->db->fetchPairs("SELECT {$idField}, {$passwordField} FROM {$tableName} WHERE {$passwordField} IS NOT NULL AND {$methodField} IS NULL");
     if ($passwords) {
         $values[$methodField] = 'default';
         foreach ($passwords as $key => $password) {
             $values[$passwordField] = $this->project->encrypt($password, $values[$methodField]);
             $this->db->update($tableName, $values, "{$idField} = '{$key}'");
         }
         $this->getBatch()->addMessage(sprintf($this->_('%d passwords encrypted for table %s.'), count($passwords), $tableName));
     } else {
         $this->getBatch()->addMessage(sprintf($this->_('No passwords found in table %s.'), $tableName));
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:20,代码来源:EncryptPasswords.php

示例6: validate

 /**
  * get array of ids which got send to the client for a given class
  *
  * @param  Syncope_Model_IDevice|string  $_deviceId
  * @param  Syncope_Model_IFolder|string  $_folderId
  * @return Syncope_Model_SyncState
  */
 public function validate($_deviceId, $_folderId, $_syncKey)
 {
     $deviceId = $_deviceId instanceof Syncope_Model_IDevice ? $_deviceId->id : $_deviceId;
     $folderId = $_folderId instanceof Syncope_Model_IFolder ? $_folderId->id : $_folderId;
     $select = $this->_db->select()->from($this->_tablePrefix . 'synckey')->where($this->_db->quoteIdentifier('device_id') . ' = ?', $deviceId)->where($this->_db->quoteIdentifier('counter') . ' = ?', $_syncKey)->where($this->_db->quoteIdentifier('type') . ' = ?', $folderId);
     $stmt = $this->_db->query($select);
     $state = $stmt->fetchObject('Syncope_Model_SyncState');
     $stmt = null;
     # see https://bugs.php.net/bug.php?id=44081
     if (!$state instanceof Syncope_Model_ISyncState) {
         return false;
     }
     $this->_convertFields($state);
     // check if this was the latest syncKey
     $select = $this->_db->select()->from($this->_tablePrefix . 'synckey')->where($this->_db->quoteIdentifier('device_id') . ' = ?', $deviceId)->where($this->_db->quoteIdentifier('counter') . ' = ?', $_syncKey + 1)->where($this->_db->quoteIdentifier('type') . ' = ?', $folderId);
     $stmt = $this->_db->query($select);
     $moreRecentState = $stmt->fetchObject('Syncope_Model_SyncState');
     $stmt = null;
     # see https://bugs.php.net/bug.php?id=44081
     // found more recent synckey => the last sync repsone got not received by the client
     if ($moreRecentState instanceof Syncope_Model_ISyncState) {
         // undelete entries marked as deleted in syncope_content table
         $this->_db->update($this->_tablePrefix . 'content', array('is_deleted' => 0), array('device_id = ?' => $deviceId, 'folder_id = ?' => $folderId, 'creation_synckey = ?' => $state->counter, 'is_deleted = ?' => 1));
         // remove entries added during latest sync in syncope_content table
         $this->_db->delete($this->_tablePrefix . 'content', array('device_id = ?' => $deviceId, 'folder_id = ?' => $folderId, 'creation_synckey > ?' => $state->counter));
     } else {
         // finaly delete all entries marked for removal in syncope_content table
         $this->_db->delete($this->_tablePrefix . 'content', array('device_id = ?' => $deviceId, 'folder_id = ?' => $folderId, 'is_deleted = ?' => 1));
     }
     // remove all other synckeys
     $this->_deleteOtherStates($state);
     return $state;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:40,代码来源:SyncState.php

示例7: aggregate

 public function aggregate($object)
 {
     if (!$object->getEntityPkValue() && $object->getId()) {
         $object->load($object->getReviewId());
     }
     $ratingModel = Mage::getModel('rating/rating');
     $ratingSummaries = $ratingModel->getEntitySummary($object->getEntityPkValue(), false);
     $nonDelete = array();
     foreach ($ratingSummaries as $ratingSummaryObject) {
         if ($ratingSummaryObject->getCount()) {
             $ratingSummary = round($ratingSummaryObject->getSum() / $ratingSummaryObject->getCount());
         } else {
             $ratingSummary = $ratingSummaryObject->getSum();
         }
         $reviewsCount = $this->getTotalReviews($object->getEntityPkValue(), true, $ratingSummaryObject->getStoreId());
         $select = $this->_read->select();
         $select->from($this->_aggregateTable)->where("{$this->_aggregateTable}.entity_pk_value = ?", $object->getEntityPkValue())->where("{$this->_aggregateTable}.entity_type = ?", $object->getEntityId())->where("{$this->_aggregateTable}.store_id = ?", $ratingSummaryObject->getStoreId());
         $oldData = $this->_read->fetchRow($select);
         $data = new Varien_Object();
         $data->setReviewsCount($reviewsCount)->setEntityPkValue($object->getEntityPkValue())->setEntityType($object->getEntityId())->setRatingSummary($ratingSummary > 0 ? $ratingSummary : 0)->setStoreId($ratingSummaryObject->getStoreId());
         $this->_write->beginTransaction();
         try {
             if ($oldData['primary_id'] > 0) {
                 $condition = $this->_write->quoteInto("{$this->_aggregateTable}.primary_id = ?", $oldData['primary_id']);
                 $this->_write->update($this->_aggregateTable, $data->getData(), $condition);
             } else {
                 $this->_write->insert($this->_aggregateTable, $data->getData());
             }
             $this->_write->commit();
         } catch (Exception $e) {
             $this->_write->rollBack();
         }
     }
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:34,代码来源:Review.php

示例8: save

 /**
  * save data
  * @param string $key
  * @param int $language_id
  * @param string $val
  * @return boolean
  */
 public function save($key, $language_id, $val, $section = "", $import = false, $newKey = "")
 {
     $data = array('key' => $newKey == "" ? $key : $newKey, 'language_id' => $language_id, 'value' => $val, 'section' => $section);
     $selectTranslate = $this->_dbTable->select()->where('`language_id` = ?', $language_id)->where('`key` = ?', $data['key']);
     if ($section != "" && !$import) {
         $data['section'] = $section;
     }
     if ($section != "" && $import) {
         $selectTranslate->where('`section` = ?', $section);
     }
     $rowTranslate = $selectTranslate->query()->fetchObject();
     // ->toArray()
     if (is_object($rowTranslate)) {
         $res = $this->_dbTable->update($data, array('id = ?' => $rowTranslate->id));
         if (!$import) {
             $this->cacheCleanTranslation();
         }
         return $res == 1;
     } else {
         $res = $this->_dbTable->insert($data);
         if (!$import) {
             $this->cacheCleanTranslation();
         }
         return $res > 0;
     }
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:33,代码来源:TranslationMapper.php

示例9: _insertContentTypes

 /**
  *
  * @param array $contentTypes
  */
 protected function _insertContentTypes(array $contentTypes)
 {
     $contentTypeModel = $this->getModelFromCache('XenForo_Model_ContentType');
     $existingContentTypes = $contentTypeModel->getContentTypesForCache();
     foreach ($contentTypes as $contentType => $contentTypeParams) {
         $existingFields = array();
         if (isset($existingContentTypes[$contentType])) {
             $existingFields = $existingContentTypes[$contentType];
         }
         if (isset($contentTypeParams['addon_id'])) {
             if (isset($contentTypeParams['fields'])) {
                 $contentTypeFields = array($contentType => $contentTypeParams['fields']);
                 $this->_insertContentTypeFields($contentTypeFields);
                 $existingFields = array_merge($contentTypeFields, $existingFields);
             }
             $fields = serialize($existingFields);
             $addOnId = $contentTypeParams['addon_id'];
             $sql = "INSERT INTO xf_content_type (\n                            content_type,\n                            addon_id,\n                            fields\n                        ) VALUES (\n                            '" . $contentType . "',\n                            '" . $addOnId . "',\n                            '" . $fields . "'\n                        ) ON DUPLICATE KEY UPDATE\n                            addon_id = '" . $addOnId . "',\n                            fields = '" . $fields . "'";
             $this->_db->query($sql);
             $existingContentTypes[$contentType] = $existingFields;
         } else {
             $this->_db->update('xf_content_type', array('fields' => serialize($existingFields)), 'content_type = ' . $this->_db->quote($contentType));
         }
     }
     $dataRegistryModel = $this->getModelFromCache('XenForo_Model_DataRegistry');
     $dataRegistryModel->set('contentTypes', $existingContentTypes);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:20150107.php

示例10: testUpdate

 /**
  * Test the Adapter's update() method.
  * Update a single row and verify that the change was made.
  * Attempt to update a row that does not exist, and verify
  * that no change was made.
  *
  * @todo: test that requires delimited identifiers.
  */
 public function testUpdate()
 {
     $idKey = $this->getResultSetKey('id');
     $titleKey = $this->getResultSetKey('title');
     $subtitleKey = $this->getResultSetKey('subtitle');
     $table = $this->getIdentifier(self::TABLE_NAME);
     $title = $this->getIdentifier('title');
     $subtitle = $this->getIdentifier('subtitle');
     $newTitle = 'New News Item 2';
     $newSubTitle = 'New Sub title 2';
     // Test that we can change the values in
     // an existing row.
     $result = $this->_db->update($table, array($title => $newTitle, $subtitle => $newSubTitle), 'id = 2');
     $this->assertEquals(1, $result);
     // Query the row to see if we have the new values.
     $select = $this->_db->select();
     $select->from($table);
     $select->where('id = 2');
     $stmt = $this->_db->query($select);
     $result = $stmt->fetchAll();
     $this->assertEquals(2, $result[0][$idKey]);
     $this->assertEquals($newTitle, $result[0][$titleKey]);
     $this->assertEquals($newSubTitle, $result[0][$subtitleKey]);
     // Test that update affects no rows if the WHERE
     // clause matches none.
     $result = $this->_db->update($table, array('title' => $newTitle, 'subtitle' => $newSubTitle), 'id = 327');
     $this->assertEquals(0, $result);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:36,代码来源:Common.php

示例11: move

 /**
  * Move tree node
  *
  * @todo Use adapter for generate conditions
  * @param Varien_Data_Tree_Node $node
  * @param Varien_Data_Tree_Node $newParent
  * @param Varien_Data_Tree_Node $prevNode
  */
 public function move($node, $newParent, $prevNode = null)
 {
     $position = 1;
     $oldPath = $node->getData($this->_pathField);
     $newPath = $newParent->getData($this->_pathField);
     $newPath = $newPath . '/' . $node->getId();
     $oldPathLength = strlen($oldPath);
     $newLevel = $newParent->getLevel() + 1;
     $levelDisposition = $newLevel - $node->getLevel();
     $data = array($this->_levelField => new Zend_Db_Expr("{$this->_levelField} + '{$levelDisposition}'"), $this->_pathField => new Zend_Db_Expr("CONCAT('{$newPath}', RIGHT({$this->_pathField}, LENGTH({$this->_pathField}) - {$oldPathLength}))"));
     $condition = $this->_conn->quoteInto("{$this->_pathField} REGEXP ?", "^{$oldPath}(/|\$)");
     $this->_conn->beginTransaction();
     $reorderData = array($this->_orderField => new Zend_Db_Expr("{$this->_orderField} + 1"));
     try {
         if ($prevNode && $prevNode->getId()) {
             $reorderCondition = "{$this->_orderField} > {$prevNode->getData($this->_orderField)}";
             $position = $prevNode->getData($this->_orderField) + 1;
         } else {
             $reorderCondition = $this->_conn->quoteInto("{$this->_pathField} REGEXP ?", "^{$newParent->getData($this->_pathField)}/[0-9]+\$");
             $select = $this->_conn->select()->from($this->_table, new Zend_Db_Expr("MIN({$this->_orderField})"))->where($reorderCondition);
             $position = (int) $this->_conn->fetchOne($select);
         }
         $this->_conn->update($this->_table, $reorderData, $reorderCondition);
         $this->_conn->update($this->_table, $data, $condition);
         $this->_conn->update($this->_table, array($this->_orderField => $position, $this->_levelField => $newLevel), $this->_conn->quoteInto("{$this->_idField} = ?", $node->getId()));
         $this->_conn->commit();
     } catch (Exception $e) {
         $this->_conn->rollBack();
         throw new Exception("Can't move tree node due to error: " . $e->getMessage());
     }
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:39,代码来源:Dbp.php

示例12: save

 public function save(Mage_Admin_Model_Permissions_Roles $role)
 {
     if ($role->getPid() > 0) {
         $row = $this->load($role->getPid());
     } else {
         $row = array('tree_level' => 0);
     }
     if ($role->getId()) {
         $this->_write->update($this->_roleTable, array('parent_id' => $role->getPid(), 'tree_level' => $row['tree_level'] + 1, 'role_name' => $role->getName()), "role_id = {$role->getId()}");
     } else {
         $this->_write->insert($this->_roleTable, array('parent_id' => $role->getPid(), 'tree_level' => $row['tree_level'] + 1, 'role_name' => $role->getName(), 'role_type' => $role->getRoleType()));
         $role->setId($this->_write->lastInsertId());
     }
     $this->_updateRoleUsersAcl($role);
     return $role->getId();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:16,代码来源:Roles.php

示例13: updateAll

 public function updateAll(My_Model_Mapper_IdentityObject $identity, array $data)
 {
     if (empty($data)) {
         throw new Exception("Data can not be empty");
     }
     return $this->_connection->update($this->_tablename, $data, $this->_getSelection()->where($identity));
 }
开发者ID:milosilic,项目名称:wbcore_mapper,代码行数:7,代码来源:Mysql.php

示例14: authorizeBlock

 /**
  * Checks if the user is allowed to login or is blocked
  *
  * An adapter authorizes and if the end resultis boolean, string or array
  * it is converted into a \Zend_Auth_Result.
  *
  * @return mixed \Zend_Auth_Adapter_Interface|\Zend_Auth_Result|boolean|string|array
  */
 protected function authorizeBlock()
 {
     try {
         $select = $this->db->select();
         $select->from('gems__user_login_attempts', array('UNIX_TIMESTAMP(gula_block_until) - UNIX_TIMESTAMP() AS wait'))->where('gula_block_until is not null')->where('gula_login = ?', $this->getLoginName())->where('gula_id_organization = ?', $this->getCurrentOrganizationId())->limit(1);
         // Not the first login
         if ($block = $this->db->fetchOne($select)) {
             if ($block > 0) {
                 $minutes = intval($block / 60) + 1;
                 // Report all is not well
                 return sprintf($this->plural('Your account is temporarily blocked, please wait a minute.', 'Your account is temporarily blocked, please wait %d minutes.', $minutes), $minutes);
             } else {
                 // Clean the block once it's past
                 $values['gula_failed_logins'] = 0;
                 $values['gula_last_failed'] = null;
                 $values['gula_block_until'] = null;
                 $where = $this->db->quoteInto('gula_login = ? AND ', $this->getLoginName());
                 $where .= $this->db->quoteInto('gula_id_organization = ?', $this->getCurrentOrganizationId());
                 $this->db->update('gems__user_login_attempts', $values, $where);
             }
         }
     } catch (\Zend_Db_Exception $e) {
         // Fall through as this does not work if the database upgrade did not run
         // \MUtil_Echo::r($e);
     }
     return true;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:35,代码来源:User.php

示例15: setETags

 /**
  * sets etags, expects ids as keys and etags as value
  *
  * @param array $etags
  * 
  * @todo maybe we should find a better place for the etag functions as this is currently only used in Calendar + Tasks
  */
 public function setETags(array $etags)
 {
     foreach ($etags as $id => $etag) {
         $where = array($this->_db->quoteInto($this->_db->quoteIdentifier($this->_identifier) . ' = ?', $id));
         $this->_db->update($this->_tablePrefix . $this->_tableName, array('etag' => $etag), $where);
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:Abstract.php


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