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


PHP ActiveRecordModel::executeUpdate方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM ClonedStore');
     $this->usd = ActiveRecordModel::getNewInstance('Currency');
     $this->usd->setID('ZZZ');
     $this->usd->save(ActiveRecord::PERFORM_INSERT);
     @unlink(ClonedStoreUpdater::getTimestampFile());
     @unlink(ClonedStoreUpdater::getIDFile());
     // create stores
     for ($k = 0; $k <= 0; $k++) {
         $this->stores[$k] = ClonedStore::getNewInstance();
         $this->stores[$k]->domain->set($k);
         $this->stores[$k]->save();
         echo $this->stores[$k]->lastImport->get();
     }
     // create categories
     $root = Category::getRootNode();
     for ($k = 0; $k <= 5; $k++) {
         $this->categories[] = $this->createCategory($root, $k);
     }
     $this->categories['1.1'] = $this->createCategory($this->categories[1], '1.1');
     $this->categories['1.2'] = $this->createCategory($this->categories[1], '1.2');
     $this->categories['1.2.1'] = $this->createCategory($this->categories['1.2'], '1.2.1');
     $this->categories['1.2.2'] = $this->createCategory($this->categories['1.2'], '1.2.2');
     usleep(1500000);
 }
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:TestStoreCloning.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM EavField');
     ActiveRecordModel::executeUpdate('DELETE FROM EavObject');
     ActiveRecordModel::executeUpdate('DELETE FROM Manufacturer');
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:EavSpecificationManagerTest.php

示例3: deleteByID

 public static function deleteByID($className, $id, $foreignKeyName)
 {
     $inst = ActiveRecordModel::getInstanceById($className, $id, ActiveRecordModel::LOAD_DATA);
     $inst->getOwner()->load();
     $inst->deleteImageFiles();
     // check if main image is being deleted
     $owner = $inst->getOwner();
     $owner->load(array(get_class($inst)));
     if ($owner->defaultImage->get()->getID() == $id) {
         // set next image (by position) as the main image
         $f = new ARSelectFilter();
         $cond = new EqualsCond(new ARFieldHandle(get_class($inst), $foreignKeyName), $owner->getID());
         $cond->addAND(new NotEqualsCond(new ARFieldHandle(get_class($inst), 'ID'), $inst->getID()));
         $f->setCondition($cond);
         $f->setOrder(new ARFieldHandle(get_class($inst), 'position'));
         $f->setLimit(1);
         $newDefaultImage = ActiveRecordModel::getRecordSet(get_class($inst), $f);
         if ($newDefaultImage->size() > 0) {
             $owner->defaultImage->set($newDefaultImage->get(0));
             $owner->save();
         }
     }
     ActiveRecordModel::executeUpdate('SET FOREIGN_KEY_CHECKS=0');
     ActiveRecordModel::executeUpdate('UPDATE ' . $className . ' SET ' . $foreignKeyName . '=NULL , protectedFields="|' . $foreignKeyName . '|" WHERE ID=' . $id);
     //return parent::deleteByID($className, $id);
 }
开发者ID:saiber,项目名称:www,代码行数:26,代码来源:ObjectImage.php

示例4: tearDown

 public function tearDown()
 {
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceParent');
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceChild');
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceSuper');
     return parent::tearDown();
 }
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:LoadReferenceTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $this->controller = new EavFieldController(self::getApplication());
     ActiveRecordModel::executeUpdate('DELETE FROM EavField');
     ActiveRecordModel::executeUpdate('DELETE FROM EavFieldGroup');
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:EavFieldControllerTest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM EavField');
     $this->controller = new UserController(self::getApplication());
     $this->initOrder();
     $this->controller->setOrder($this->order);
     $this->controller->setUser($this->user);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:UserControllerTest.php

示例7: delete

 public function delete()
 {
     if (ActiveRecordModel::getApplication()->getConfig()->get('CLONE_STORE_TYPE') == 'CLONE_STORE_MASTER') {
         return parent::delete();
     } else {
         ActiveRecordModel::executeUpdate('SET FOREIGN_KEY_CHECKS=0');
         ActiveRecordModel::executeUpdate('UPDATE ' . __CLASS__ . ' SET productID=NULL, variationID=NULL, protectedFields="|productID||variationID|" WHERE ID=' . $this->getID());
     }
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:ProductVariationValue.php

示例8: initOrder

 protected function initOrder()
 {
     // set up currency
     $this->setUpCurrency();
     $this->usd->decimalCount->set(2);
     $this->usd->clearRoundingRules();
     $this->usd->save();
     // initialize order
     ActiveRecordModel::executeUpdate('DELETE FROM User WHERE email="test@test.com"');
     $user = User::getNewInstance('test@test.com');
     $user->save();
     $this->user = $user;
     $address = UserAddress::getNewInstance();
     $address->countryID->set('US');
     $state = State::getInstanceById(1, State::LOAD_DATA);
     $address->state->set(State::getInstanceById(1));
     $address->postalCode->set(90210);
     $address->save();
     $billing = BillingAddress::getNewInstance($user, $address);
     $billing->save();
     $address = clone $address;
     $address->save();
     $shipping = ShippingAddress::getNewInstance($user, $address);
     $shipping->save();
     $this->order = CustomerOrder::getNewInstance($user);
     $this->order->shippingAddress->set($shipping->userAddress->get());
     $this->order->billingAddress->set($billing->userAddress->get());
     // set up products
     $product = Product::getNewInstance(Category::getInstanceById(Category::ROOT_ID), 'test1');
     $product->save();
     $product->setPrice('USD', 100);
     $product->stockCount->set(20);
     $product->isEnabled->set(1);
     $product->save();
     $this->products[] = $product;
     $product = Product::getNewInstance(Category::getInstanceById(Category::ROOT_ID), 'test2');
     $product->save();
     $product->setPrice('USD', 200);
     $product->stockCount->set(20);
     $product->isEnabled->set(1);
     $product->save();
     $this->products[] = $product;
     $product = Product::getNewInstance(Category::getInstanceById(Category::ROOT_ID), 'test3');
     $product->save();
     $product->setPrice('USD', 400);
     $product->isSeparateShipment->set(true);
     $product->stockCount->set(20);
     $product->isEnabled->set(1);
     $product->save();
     $this->products[] = $product;
 }
开发者ID:saiber,项目名称:livecart,代码行数:51,代码来源:LiveCartTest.php

示例9: bulkAddIndex

 public static function bulkAddIndex($list)
 {
     $chunks = array();
     while ($item = array_pop($list)) {
         $locale = array_key_exists('locale', $item['meta']) ? $item['meta']['locale'] : null;
         if ($locale && strlen($locale)) {
             $locale = '0x' . bin2hex($locale);
         } else {
             $locale = 'NULL';
         }
         $chunks[] = sprintf('(%s, %s, %s, %s, %s)', '0x' . bin2hex($item['value']), $locale, array_key_exists('section', $item) ? '0x' . bin2hex($item['section']) : 'NULL', '0x' . bin2hex(serialize($item['meta'])), array_key_exists('sort', $item) && is_numeric($item['sort']) ? intval($item['sort'], 10) : 'NULL');
     }
     ActiveRecordModel::executeUpdate('INSERT INTO ' . __CLASS__ . '(value, locale, section, meta, sort) VALUES ' . implode(',', $chunks));
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:SearchableItem.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM Tax');
     ActiveRecordModel::executeUpdate('DELETE FROM TaxRate');
     ActiveRecordModel::executeUpdate('DELETE FROM Currency');
     ActiveRecordModel::executeUpdate('DELETE FROM DiscountCondition');
     ActiveRecordModel::executeUpdate('DELETE FROM DiscountAction');
     ActiveRecordModel::executeUpdate('DELETE FROM DeliveryZone');
     ActiveRecordModel::executeUpdate('DELETE FROM ShippingService');
     BusinessRuleController::clearCache();
     $this->initOrder();
     $this->config->setRuntime('DELIVERY_TAX', '');
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:OrderTestCommon.php

示例11: import

 public function import()
 {
     $this->application->setDevMode(true);
     ignore_user_abort(true);
     ini_set('memory_limit', '512M');
     set_time_limit(0);
     if ($this->request->get('password') != $this->config->get('CLONE_STORE_API_KEY')) {
         return new RawResponse('Wrong password');
     }
     ActiveRecordModel::executeUpdate('SET FOREIGN_KEY_CHECKS=0;');
     ActiveRecord::getLogger()->setLogFileName(null);
     $dir = $this->getFileDir();
     //if (ob_get_length())
     //{
     ob_flush();
     ob_end_clean();
     //}
     //echo str_repeat('FLUSH ', 10000);
     foreach (scandir($dir) as $file) {
         if (strlen($file) < 3) {
             continue;
         }
         $path = $dir . $file;
         if (substr($file, -4) == '.sql') {
             $f = fopen($path, 'r');
             $prev = '';
             while (!feof($f)) {
                 $s = $prev . fread($f, 1024 * 1024);
                 if (!feof($f)) {
                     $pos = strrpos($s, ";\n");
                     $prev = substr($s, $pos + 1);
                     $s = substr($s, 0, $pos);
                 }
                 Installer::loadDatabaseDump($s, true);
             }
         } else {
             $this->untar($path, ClassLoader::getRealPath('public.upload.'));
         }
         unlink($path);
     }
     $this->user->allowBackendAccess();
     $c = new ProductImageController($this->application);
     $c->resizeImages();
     Category::reindex();
     Category::recalculateProductsCount();
 }
开发者ID:saiber,项目名称:www,代码行数:46,代码来源:StoreSyncController.php

示例12: getIdOffsets

 private function getIdOffsets()
 {
     $file = $this->getOffsetsFile();
     if (!file_exists($file)) {
         $offsets = array();
         $types = $this->getRecordTypes();
         unset($types[array_search('Language', $types)]);
         unset($types[array_search('ProductRelationship', $types)]);
         foreach ($types as $type) {
             $f = new ARSelectFilter();
             $f->setOrder(new ARFieldHandle($type, 'ID'), 'DESC');
             $f->setLimit(1);
             $record = array_shift(ActiveRecordModel::getRecordSetArray($type, $f));
             if (!$record) {
                 $record['ID'] = 0;
             }
             $offsets[$type] = $record['ID'];
             try {
                 ActiveRecordModel::executeUpdate('ALTER TABLE ' . $type . ' AUTO_INCREMENT = ' . ($offsets[$type] + 1));
             } catch (Exception $e) {
                 // we don't care much if it didn't work (won't work with MySQL <5.0.3)
             }
         }
         file_put_contents($file, '<?php return ' . var_export($offsets, true) . '; ?>');
     }
     return include $file;
 }
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:LiveCartImporter.php

示例13: tearDown

 public function tearDown()
 {
     ActiveRecordModel::executeUpdate('DROP TABLE SerializedModel');
     return parent::tearDown();
 }
开发者ID:saiber,项目名称:www,代码行数:5,代码来源:SerializeTest.php

示例14: testDoubleRatingsByIPWithTimeDifference

 public function testDoubleRatingsByIPWithTimeDifference()
 {
     $_SERVER['REMOTE_ADDR'] = '255.255.255.254';
     self::getApplication()->getConfig()->set('RATING_SAME_IP_TIME', 24);
     $this->request->set('rating_', 4);
     $this->request->set('ajax', 'true');
     // first rating
     $this->assertRatingError(false);
     ActiveRecordModel::executeUpdate('UPDATE ProductRating SET dateCreated="1997-01-01"');
     $this->assertRatingError(false);
     // vote again - get error
     $this->assertRatingError();
     // no time difference - vote as much as you want
     self::getApplication()->getConfig()->set('RATING_SAME_IP_TIME', 0);
     $this->assertRatingError(false);
 }
开发者ID:saiber,项目名称:livecart,代码行数:16,代码来源:ProductControllerTest.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM ProductRatingType');
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:ProductRatingTypeTest.php


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