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


PHP CM_Db_Db::select方法代码示例

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


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

示例1: _load

 protected function _load()
 {
     $result = CM_Db_Db::select('cm_model_languagekey', 'name', 'name LIKE ".%"', 'name ASC');
     while ($section = $result->fetch()) {
         $this->_addLanguageNode($section['name']);
     }
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:7,代码来源:Language.php

示例2: test_Get

 public function test_Get()
 {
     $user = CMTest_TH::createUser();
     $user->getRoles()->add(self::ROLE_A, 2000);
     $stamps = CM_Db_Db::select('cm_role', array('startStamp', 'expirationStamp'), array('userId' => $user->getId()))->fetch();
     $this->assertEquals($stamps['startStamp'], $user->getRoles()->getStartStamp(self::ROLE_A));
     $this->assertEquals($stamps['expirationStamp'], $user->getRoles()->getExpirationStamp(self::ROLE_A));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:RolesTest.php

示例3: findByKeyAndChannel

 /**
  * @param string                          $key
  * @param CM_Model_StreamChannel_Abstract $channel
  * @return CM_Model_Stream_Publish|null
  */
 public static function findByKeyAndChannel($key, CM_Model_StreamChannel_Abstract $channel)
 {
     $id = CM_Db_Db::select('cm_stream_publish', 'id', array('key' => (string) $key, 'channelId' => $channel->getId()))->fetchColumn();
     if (!$id) {
         return null;
     }
     return new static($id);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:13,代码来源:Publish.php

示例4: findByData

 public function findByData($type, array $data)
 {
     $result = CM_Db_Db::select($this->_getTableName($type), array('id'), $data)->fetch();
     if (false === $result) {
         $result = null;
     }
     return $result;
 }
开发者ID:aladin1394,项目名称:CM,代码行数:8,代码来源:Database.php

示例5: __construct

 /**
  * @param int $id
  * @throws CM_Exception_Nonexistent
  */
 public function __construct($id)
 {
     $this->_id = (int) $id;
     $this->_text = CM_Db_Db::select('cm_captcha', 'number', array('captcha_id' => $this->getId()))->fetchColumn();
     if (!$this->_text) {
         throw new CM_Exception_Nonexistent('Invalid captcha id `' . $id . '`', CM_Exception::WARN);
     }
     $this->_fontPath = CM_Util::getModulePath('CM') . 'resources/font/comicsans.ttf';
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:13,代码来源:Captcha.php

示例6: deleteOlder

 /**
  * @param int $age
  */
 public static function deleteOlder($age)
 {
     $age = (int) $age;
     $result = CM_Db_Db::select('cm_tmp_userfile', 'uniqid', '`createStamp` < ' . (time() - $age));
     foreach ($result->fetchAllColumn() as $uniqid) {
         $tmpFile = new CM_File_UserContent_Temp($uniqid);
         $tmpFile->delete();
     }
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:12,代码来源:Temp.php

示例7: queueOutstanding

 public function queueOutstanding()
 {
     $executeAtMax = time();
     $result = CM_Db_Db::select('cm_jobdistribution_delayedqueue', '*', '`executeAt` <= ' . $executeAtMax, '`executeAt` ASC');
     while ($row = $result->fetch()) {
         $job = $this->_instantiateJob($row['className']);
         if ($job) {
             $job->queue(CM_Params::decode($row['params'], true));
         }
     }
     CM_Db_Db::delete('cm_jobdistribution_delayedqueue', '`executeAt` <= ' . $executeAtMax);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:12,代码来源:DelayedQueue.php

示例8: getDefaults

 /**
  * @return array of arrays
  */
 public static function getDefaults()
 {
     $cacheKey = CM_CacheConst::User_Asset_Preferences_Defaults;
     $cache = CM_Cache_Local::getInstance();
     if (($defaults = $cache->get($cacheKey)) === false) {
         $defaults = array();
         $rows = CM_Db_Db::select('cm_user_preferenceDefault', array('section', 'key', 'preferenceId', 'defaultValue', 'configurable'))->fetchAll();
         foreach ($rows as $default) {
             if (!isset($defaults[$default['section']])) {
                 $defaults[$default['section']] = array();
             }
             $defaults[$default['section']][$default['key']] = array('id' => (int) $default['preferenceId'], 'value' => (bool) $default['defaultValue'], 'configurable' => (bool) $default['configurable']);
         }
         $cache->set($cacheKey, $defaults);
     }
     return $defaults;
 }
开发者ID:cargomedia,项目名称:cm,代码行数:20,代码来源:Preferences.php

示例9: testFlushVariationCache

 public function testFlushVariationCache()
 {
     $test = CM_Model_Splittest::create('foo', ['v1', 'v2']);
     $variation1 = new CM_Model_SplittestVariation(CM_Db_Db::select('cm_splittestVariation', 'id', ['name' => 'v1'])->fetchColumn());
     $variation2 = new CM_Model_SplittestVariation(CM_Db_Db::select('cm_splittestVariation', 'id', ['name' => 'v2'])->fetchColumn());
     $variation2->setEnabled(false);
     $fixture = $this->mockClass('CM_Splittest_Fixture')->newInstanceWithoutConstructor();
     $fixture->mockMethod('getId')->set(1);
     $fixture->mockMethod('getFixtureType')->set(1);
     CMTest_TH::timeForward(1);
     $variation = CMTest_TH::callProtectedMethod($test, '_getVariationFixture', [$fixture]);
     $this->assertSame('v1', $variation);
     $test->flush();
     $variation2->setEnabled(true);
     $variation1->setEnabled(false);
     $variation = CMTest_TH::callProtectedMethod($test, '_getVariationFixture', [$fixture]);
     $this->assertSame('v2', $variation);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:18,代码来源:SplittestTest.php

示例10: _findLock

 /**
  * @param CM_Cli_Command $command
  * @return array|null
  */
 protected function _findLock(CM_Cli_Command $command)
 {
     $commandName = $command->getName();
     $lock = CM_Db_Db::select('cm_cli_command_manager_process', array('hostId', 'processId'), array('commandName' => $commandName))->fetch();
     if (false === $lock) {
         return null;
     }
     return $lock;
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:13,代码来源:CommandManager.php

示例11: int

<?php

if (CM_Db_Db::existsTable('cm_model_location_city_ip') && !CM_Db_Db::existsTable('cm_model_location_ip')) {
    CM_Db_Db::exec('RENAME TABLE `cm_model_location_city_ip` TO `cm_model_location_ip`');
}
if (CM_Db_Db::existsTable('cm_model_location_ip')) {
    if (CM_Db_Db::existsIndex('cm_model_location_ip', 'cityId')) {
        CM_Db_Db::exec('DROP INDEX `cityId` ON `cm_model_location_ip`');
    }
    if (CM_Db_Db::existsColumn('cm_model_location_ip', 'cityId') && !CM_Db_Db::existsColumn('cm_model_location_ip', 'id')) {
        CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` CHANGE COLUMN `cityId` `id` int(10) unsigned NOT NULL ');
    }
    if (!CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
        CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` ADD COLUMN `level` int(10) unsigned NOT NULL AFTER `id`');
    }
    if (CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
        CM_Db_Db::update('cm_model_location_ip', array('level' => CM_Model_Location::LEVEL_CITY), array('level' => 0));
    }
    if (CM_Db_Db::existsTable('cm_model_location_country_ip')) {
        $result = CM_Db_Db::select('cm_model_location_country_ip', array('countryId', 'ipStart', 'ipEnd'));
        foreach ($result->fetchAll() as $row) {
            CM_Db_Db::insert('cm_model_location_ip', array('id' => $row['countryId'], 'level' => CM_Model_Location::LEVEL_COUNTRY, 'ipStart' => $row['ipStart'], 'ipEnd' => $row['ipEnd']));
        }
        CM_Db_Db::exec('DROP TABLE `cm_model_location_country_ip`');
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:26,代码来源:30.php

示例12: foreach

<?php

$nameList[] = 'Your browser is no longer supported';
$nameList[] = 'We recommend upgrading to the latest Internet Explorer, Google Chrome, Firefox, or Opera. Click here for <a href="{$url}">more information</a>';
$nameList[] = 'If you are using IE 9 or later, make sure you <a href="{$url}">turn off "Compatibility View"</a>';
foreach ($nameList as $name) {
    $id = CM_Db_Db::select('cm_languageKey', 'id', array('name' => $name))->fetchColumn();
    if ($id) {
        CM_Db_Db::update('cm_languageKey', array('name' => $name . '.'), array('id' => $id));
        CM_Db_Db::exec('UPDATE `cm_languageValue` SET `value`= CONCAT(`value`, ".") WHERE `languageKeyId` = ' . $id);
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:12,代码来源:11.php

示例13: _verify

 protected function _verify($countryDataExpected, $regionDataExpected, $cityDataExpected, $zipCodeDataExpected, $ipDataExpected)
 {
     $countryDataActual = CM_Db_Db::select('cm_model_location_country', '*')->fetchAll();
     $this->assertEquals($countryDataExpected, $countryDataActual);
     $regionDataActual = CM_Db_Db::select('cm_model_location_state', '*')->fetchAll();
     $this->assertEquals($regionDataExpected, $regionDataActual);
     $cityDataActual = CM_Db_Db::select('cm_model_location_city', '*')->fetchAll();
     $this->assertEquals($cityDataExpected, $cityDataActual);
     $zipCodeDataActual = CM_Db_Db::select('cm_model_location_zip', '*')->fetchAll();
     $this->assertEquals($zipCodeDataExpected, $zipCodeDataActual);
     $ipDataActual = CM_Db_Db::select('cm_model_location_ip', '*')->fetchAll();
     $this->assertEquals($ipDataExpected, $ipDataActual);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:13,代码来源:MaxMindTest.php

示例14: findByLocation

 /**
  * @param CM_Model_Location $location
  * @return CM_Model_Currency|null
  */
 public static function findByLocation(CM_Model_Location $location)
 {
     $country = $location->get(CM_Model_Location::LEVEL_COUNTRY);
     if (null === $country) {
         return null;
     }
     $cache = CM_Cache_Local::getInstance();
     $cacheKey = CM_CacheConst::Currency_CountryId . '_countryId:' . $country->getId();
     if (false === ($currencyId = $cache->get($cacheKey))) {
         $currencyId = CM_Db_Db::select('cm_model_currency_country', 'currencyId', ['countryId' => $country->getId()])->fetchColumn();
         $currencyId = $currencyId ? (int) $currencyId : null;
         $cache->set($cacheKey, $currencyId);
     }
     if (null === $currencyId) {
         return null;
     }
     return new self($currencyId);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:22,代码来源:Currency.php

示例15: int

<?php

if (!CM_Db_Db::existsTable('cm_requestClientCounter')) {
    CM_Db_Db::exec('
        CREATE TABLE `cm_requestClientCounter` (
          `counter` int(10) unsigned NOT NULL,
          PRIMARY KEY (`counter`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    ');
    CM_Db_Db::insert('cm_requestClientCounter', array('counter' => 0));
}
if (CM_Db_Db::existsTable('cm_requestClient')) {
    $highestEntry = (int) CM_Db_Db::select('cm_requestClient', 'id', null, array('id' => 'DESC'))->fetchColumn();
    CM_Db_Db::update('cm_requestClientCounter', array('counter' => $highestEntry));
    CM_Db_Db::exec('DROP TABLE IF EXISTS `cm_requestClient`;');
}
开发者ID:cargomedia,项目名称:cm,代码行数:16,代码来源:37.php


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