• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CM_Db_Db类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createEntry

 /**
  * @param string $name
  * @return int
  */
 public function createEntry($name)
 {
     $id = CM_Db_Db::insert('index_mock', array('name' => (string) $name));
     $this->updateDocuments($id);
     $this->refreshIndex();
     return (int) $id;
 }
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:AbstractTest.php


示例2: _createStatic

 protected static function _createStatic(array $data)
 {
     $user = null;
     $userId = null;
     if (isset($data['user'])) {
         /** @var CM_Model_User $user */
         $user = $data['user'];
         $userId = $user->getId();
     }
     $key = (string) $data['key'];
     $start = (int) $data['start'];
     /** @var CM_Model_StreamChannel_Abstract $streamChannel */
     $streamChannel = $data['streamChannel'];
     if (!$streamChannel->isValid()) {
         throw new CM_Exception_Invalid('Stream channel not valid', null, array('severity' => CM_Exception::WARN));
     }
     $allowedUntil = $streamChannel->canSubscribe($user, time());
     if ($allowedUntil <= time()) {
         throw new CM_Exception_NotAllowed('Not allowed to subscribe');
     }
     $id = CM_Db_Db::insert('cm_stream_subscribe', array('userId' => $userId, 'start' => $start, 'allowedUntil' => $allowedUntil, 'channelId' => $streamChannel->getId(), 'key' => $key));
     $streamSubscribe = new self($id);
     $streamChannel->onSubscribe($streamSubscribe);
     return $streamSubscribe;
 }
开发者ID:aladin1394,项目名称:CM,代码行数:25,代码来源:Subscribe.php


示例3: _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


示例4: _dbToFileSql

 /**
  * @param string $namespace
  */
 private function _dbToFileSql($namespace)
 {
     $namespace = (string) $namespace;
     $tables = CM_Db_Db::exec("SHOW TABLES LIKE ?", array(strtolower($namespace) . '_%'))->fetchAllColumn();
     sort($tables);
     $dump = CM_Db_Db::getDump($tables, true);
     CM_File::create(CM_Util::getModulePath($namespace) . '/resources/db/structure.sql', $dump);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:Cli.php


示例5: 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


示例6: 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


示例7: testTrailingWhitespaceInLanguageKeyName

 public function testTrailingWhitespaceInLanguageKeyName()
 {
     CM_Db_Db::insert('cm_model_languagekey', ['name'], [['foo '], ['foo']]);
     $language = CM_Model_Language::create('Foo', 'foo', true);
     $language->getTranslations()->getAssociativeArray();
     $this->assertEquals(['foo ', 'foo'], array_keys($language->getTranslations()->getAssociativeArray()));
     $this->assertCount(2, $language->getTranslations());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:AbstractTest.php


示例8: 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


示例9: reload

 public function reload(CM_OutputStream_Interface $output)
 {
     $tableNames = CM_Db_Db::exec('SHOW TABLES')->fetchAllColumn();
     CM_Db_Db::exec('SET foreign_key_checks = 0;');
     foreach ($tableNames as $table) {
         CM_Db_Db::delete($table);
     }
     CM_Db_Db::exec('SET foreign_key_checks = 1;');
     $this->_setInitialVersion();
 }
开发者ID:cargomedia,项目名称:cm,代码行数:10,代码来源:SetupScript.php


示例10: remove

 /**
  * @param string $phrase
  */
 public function remove($phrase)
 {
     $languageKey = CM_Model_LanguageKey::findByName($phrase);
     if (!$languageKey) {
         return;
     }
     CM_Db_Db::delete('cm_languageValue', array('languageKeyId' => $languageKey->getId(), 'languageId' => $this->_language->getId()));
     $this->_change();
     (new self($this->_language, !$this->_javascriptOnly))->_change();
 }
开发者ID:cargomedia,项目名称:cm,代码行数:13,代码来源:All.php


示例11: testDelete

 public function testDelete()
 {
     $language = CM_Model_Language::create('Foo', 'foo', true);
     $language->setTranslation('foo', 'bar');
     $this->assertSame(array('foo' => array('value' => 'bar', 'variables' => array())), $language->getTranslations()->getAssociativeArray());
     $languageKey = CM_Model_LanguageKey::findByName('foo');
     $languageKey->delete();
     $this->assertSame(array(), $language->getTranslations()->getAssociativeArray());
     $this->assertSame(0, CM_Db_Db::count('cm_model_languagekey', array('name' => 'foo')));
     $this->assertSame(0, CM_Db_Db::count('cm_languageValue', array('languageKeyId' => $languageKey->getId(), 'languageId' => $language->getId())));
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:11,代码来源:LanguageKeyTest.php


示例12: 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


示例13: testGetInvalidMetaInfo

 public function testGetInvalidMetaInfo()
 {
     $paging = $this->getMockBuilder('CM_Paging_Log_Abstract')->setMethods(array('getType'))->disableOriginalConstructor()->getMockForAbstractClass();
     $paging->expects($this->any())->method('getType')->will($this->returnValue(14));
     /** @var CM_Paging_Log_Abstract $paging */
     $paging->__construct();
     CM_Db_Db::insert('cm_log', array('msg' => 'foo', 'metaInfo' => str_ireplace('{', '/', serialize(array('foo' => 'bar'))), 'timeStamp' => time(), 'type' => 14));
     $items = $paging->getItems();
     $this->assertSame(1, count($items));
     $this->assertSame('foo', $items[0]['msg']);
     $this->assertSame(null, $items[0]['metaInfo']);
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:12,代码来源:AbstractTest.php


示例14: testPrepare

 public function testPrepare()
 {
     $actor = CMTest_TH::createUser();
     $action = new CM_Action_Mock('foo', $actor);
     $action->prepare(null);
     CM_Db_Db::insert('cm_actionLimit', array('type' => 1, 'actionType' => 1, 'actionVerb' => 1, 'role' => null, 'limit' => 0, 'period' => 0));
     CMTest_TH::clearCache();
     try {
         $action->prepare(null);
         $this->fail('Limited action did not throw exception');
     } catch (CM_Exception_ActionLimit $e) {
         $this->assertSame('Mock overshoot', $e->getMessage());
     }
 }
开发者ID:cargomedia,项目名称:cm,代码行数:14,代码来源:MockTest.php


示例15: testCacheCustom

 public function testCacheCustom()
 {
     $source = new CM_PagingSource_Sql('`num`', 'test');
     $fileCache = CM_Cache_Persistent::getInstance();
     $source->enableCache(null, $fileCache);
     $this->assertEquals(100, $source->getCount());
     CM_Db_Db::delete('test', array('num' => 0));
     $this->assertEquals(100, $source->getCount());
     $source->clearCache();
     $this->assertEquals(99, $source->getCount());
     CM_Db_Db::delete('test', array('num' => 1));
     $this->assertEquals(99, $source->getCount());
     $fileCache->flush();
     $this->assertEquals(98, $source->getCount());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:15,代码来源:AbstractTest.php


示例16: testCache

 public function testCache()
 {
     $source = new CM_PagingSource_Sql('`num`', 'test');
     $source->enableCache();
     $this->assertSame(100, $source->getCount());
     $sourceNocache = new CM_PagingSource_Sql('`num`', 'test');
     $this->assertSame(100, $sourceNocache->getCount());
     CM_Db_Db::delete('test', array('num' => 0));
     $this->assertSame(100, $source->getCount());
     $this->assertSame(99, $sourceNocache->getCount());
     $source->clearCache();
     $this->assertSame(99, $source->getCount());
     $this->assertSame(99, $sourceNocache->getCount());
     CM_Cache_Shared::getInstance()->flush();
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:15,代码来源:AbstractTest.php


示例17: _createStatic

 protected static function _createStatic(array $data)
 {
     /** @var CM_Model_User $user */
     $user = $data['user'];
     /** @var CM_Model_StreamChannel_Abstract $streamChannel */
     $streamChannel = $data['streamChannel'];
     $start = (int) $data['start'];
     if (!$streamChannel->isValid()) {
         throw new CM_Exception_Invalid('Stream channel not valid', CM_Exception::WARN);
     }
     $allowedUntil = $streamChannel->canPublish($user, time());
     if ($allowedUntil <= time()) {
         throw new CM_Exception_NotAllowed('Not allowed to publish');
     }
     $key = (string) $data['key'];
     $id = CM_Db_Db::insert('cm_stream_publish', array('userId' => $user->getId(), 'start' => $start, 'allowedUntil' => $allowedUntil, 'key' => $key, 'channelId' => $streamChannel->getId()));
     $streamPublish = new self($id);
     $streamChannel->onPublish($streamPublish);
     return $streamPublish;
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:20,代码来源:Publish.php


示例18: testPaging

 public function testPaging()
 {
     $language = CM_Model_Language::create('Foo', 'foo', true);
     $languagePagingAll = $language->getTranslations();
     $languagePagingJavascriptOnly = $language->getTranslations(true);
     $this->assertEquals([], $languagePagingAll);
     $this->assertEquals([], $languagePagingJavascriptOnly);
     $languagePagingAll->set('foo', 'foo');
     // js
     CM_Db_Db::update('cm_model_languagekey', ['javascript' => 1], ['name' => 'foo']);
     $languagePagingJavascriptOnly->set('bar', 'bar');
     // js
     CM_Db_Db::update('cm_model_languagekey', ['javascript' => 1], ['name' => 'bar']);
     $languagePagingAll->set('baz', 'baz');
     // no js
     $this->assertSame('foo', $language->getTranslations()->get('foo'));
     $this->assertSame('foo', $language->getTranslations(true)->get('foo'));
     $this->assertSame('bar', $language->getTranslations()->get('bar'));
     $this->assertSame('bar', $language->getTranslations(true)->get('bar'));
     $this->assertSame('baz', $language->getTranslations()->get('baz'));
     $exception = $this->catchException(function () use($language) {
         $language->getTranslations(true)->get('baz');
     });
     $this->assertInstanceOf('CM_Exception_Invalid', $exception);
     $languagePagingJavascriptOnly->set('foo', 'bar');
     $this->assertSame('bar', $language->getTranslations(true)->get('foo'));
     $this->assertSame('bar', $language->getTranslations()->get('foo'));
     $languagePagingAll->set('bar', 'foo');
     $this->assertSame('foo', $language->getTranslations()->get('bar'));
     $this->assertSame('foo', $language->getTranslations(true)->get('bar'));
     $languagePagingAll->remove('foo');
     $this->assertSame(null, $language->getTranslations()->get('foo'));
     $this->assertSame(null, $language->getTranslations(true)->get('foo'));
     $languagePagingJavascriptOnly->remove('bar');
     $this->assertSame(null, $language->getTranslations()->get('bar'));
     $this->assertSame(null, $language->getTranslations(true)->get('bar'));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:37,代码来源:AllTest.php


示例19: _findDataById

 /**
  * @param string $id
  * @return array|null
  */
 private static function _findDataById($id)
 {
     $cacheKey = self::_getCacheKey($id);
     $cache = CM_Cache_Shared::getInstance();
     if (($data = $cache->get($cacheKey)) === false) {
         $data = CM_Db_Db::select('cm_session', array('data', 'expires'), array('sessionId' => $id))->fetch();
         if (!$data) {
             return null;
         }
         $cache->set($cacheKey, $data, self::LIFETIME_DEFAULT);
     }
     return $data;
 }
开发者ID:cargomedia,项目名称:cm,代码行数:17,代码来源:Session.php


示例20: _createStatic

 protected static function _createStatic(array $data)
 {
     $name = (string) $data['name'];
     $percentage = self::_checkPercentage($data['percentage']);
     CM_Db_Db::insert('cm_splitfeature', array('name' => $name, 'percentage' => $percentage));
     return new static($name);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:Splitfeature.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CM_Params类代码示例发布时间:2022-05-23
下一篇:
PHP CMTest_TH类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap