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


PHP CM_Db_Db::count方法代码示例

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


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

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

示例2: testQueue

 public function testQueue()
 {
     $user = $this->getMock('CM_Model_User', array('getEmail', 'getSite'), array(CMTest_TH::createUser()->getId()));
     $user->expects($this->any())->method('getEmail')->will($this->returnValue('foo@example.com'));
     $user->expects($this->any())->method('getSite')->will($this->returnValue(CM_Site_Abstract::factory()));
     $msg = new CM_Mail($user, null);
     $msg->setSubject('testSubject');
     $msg->setHtml('<b>hallo</b>');
     $msg->addReplyTo('foo@bar.com');
     $msg->addCc('foo@bar.org', 'foobar');
     $msg->addBcc('foo@bar.net');
     $msg->sendDelayed();
     $this->assertRow('cm_mail', array('subject' => 'testSubject', 'text' => 'hallo', 'html' => '<b>hallo</b>', 'to' => serialize($msg->getTo()), 'replyTo' => serialize($msg->getReplyTo()), 'cc' => serialize($msg->getCc()), 'bcc' => serialize($msg->getBcc())));
     $this->assertEquals(1, CM_Db_Db::count('cm_mail', 'id'));
     CM_Mail::processQueue(1);
     $this->assertEquals(0, CM_Db_Db::count('cm_mail', 'id'));
 }
开发者ID:aladin1394,项目名称:CM,代码行数:17,代码来源:MailTest.php

示例3: getFixtureCount

 /**
  * @return int
  */
 public function getFixtureCount()
 {
     return CM_Db_Db::count('cm_splitfeature_fixture', array('splitfeatureId' => $this->getId()));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:Splitfeature.php

示例4: exists

 /**
  * @param string $name
  * @return bool
  */
 public static function exists($name)
 {
     $name = (string) $name;
     return (bool) CM_Db_Db::count('cm_model_languagekey', array('name' => $name));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:9,代码来源:LanguageKey.php

示例5: testCount

 public function testCount()
 {
     $this->assertSame(0, CM_Db_Db::count('test'));
     CM_Db_Db::insert('test', array('bar' => 'bar1', 'sequence' => 1));
     $this->assertSame(1, CM_Db_Db::count('test'));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:6,代码来源:DbTest.php

示例6: testCreateCountry

 public function testCreateCountry()
 {
     $country = CM_Model_Location::createCountry('Example Country', 'EC');
     $this->assertSame(CM_Model_Location::LEVEL_COUNTRY, $country->getLevel());
     $this->assertSame(1, CM_Db_Db::count('cm_model_location_country', array('abbreviation' => 'EC')));
     $this->assertSame('Example Country', $country->getName());
     $this->assertSame('EC', $country->getAbbreviation());
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:8,代码来源:LocationTest.php

示例7: getQueueSize

 /**
  * @return int
  */
 public static function getQueueSize()
 {
     return CM_Db_Db::count('cm_mail');
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:7,代码来源:Mail.php

示例8: testCollapse

 public function testCollapse()
 {
     $values[] = array(1, null, 1, 1, null, 1, 1);
     $values[] = array(1, null, 1, 1, null, 1, 2);
     $values[] = array(1, null, 1, 1, null, 2, 1);
     $values[] = array(1, null, 1, 1, null, 3, 1);
     $values[] = array(1, null, 1, 1, null, 4, 10);
     $values[] = array(1, null, 1, 1, 1, 4, 10);
     $values[] = array(1, null, 2, 1, null, 4, 100);
     $values[] = array(1, null, 1, 2, null, 4, 100);
     $values[] = array(1, null, 1, 1, null, 5, 100);
     CM_Db_Db::insert('cm_action', array('actorId', 'ip', 'verb', 'type', 'actionLimitType', 'createStamp', 'count'), $values);
     CM_Action_Abstract::collapse(1, 4);
     $this->assertEquals(6, CM_Db_Db::count('cm_action'));
     $this->assertRow('cm_action', array('verb' => 1, 'type' => 1, 'createStamp' => 2, 'count' => 5));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:16,代码来源:AbstractTest.php

示例9: setPeriod

 /**
  * @param int|null $role
  * @param int      $period
  */
 public function setPeriod($role, $period)
 {
     $role = $role ? (int) $role : null;
     $period = (int) $period;
     if (CM_Db_Db::count('cm_actionLimit', array('actionType' => $this->getActionType(), 'actionVerb' => $this->getActionVerb(), 'type' => $this->getType(), 'role' => $role))) {
         CM_Db_Db::update('cm_actionLimit', array('period' => $period), array('actionType' => $this->getActionType(), 'actionVerb' => $this->getActionVerb(), 'type' => $this->getType(), 'role' => $role));
     } else {
         CM_Db_Db::insert('cm_actionLimit', array('period' => $period, 'actionType' => $this->getActionType(), 'actionVerb' => $this->getActionVerb(), 'type' => $this->getType(), 'role' => $role));
     }
     $this->_change();
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:15,代码来源:Abstract.php

示例10: updateSequence

 /**
  * @param string     $table
  * @param string     $column
  * @param int        $position
  * @param array      $whereRow Associative array field=>value
  * @param array|null $where    Associative array field=>value
  * @throws CM_Exception_Invalid
  */
 public static function updateSequence($table, $column, $position, array $whereRow, array $where = null)
 {
     $table = (string) $table;
     $column = (string) $column;
     $position = (int) $position;
     if (null === $where) {
         $where = array();
     }
     if ($position <= 0 || $position > CM_Db_Db::count($table, $where)) {
         throw new CM_Exception_Invalid('Sequence out of bounds.');
     }
     $whereMerged = array_merge($whereRow, $where);
     $positionOld = CM_Db_Db::select($table, $column, $whereMerged)->fetchColumn();
     if (false === $positionOld) {
         throw new CM_Exception_Invalid('Could not retrieve original sequence number.');
     }
     $positionOld = (int) $positionOld;
     if ($position > $positionOld) {
         $upperBound = $position;
         $lowerBound = $positionOld;
         $direction = -1;
     } else {
         $upperBound = $positionOld;
         $lowerBound = $position;
         $direction = 1;
     }
     $client = self::getClient();
     $query = new CM_Db_Query_UpdateSequence($client, $table, $column, $direction, $where, $lowerBound, $upperBound);
     $query->execute();
     self::update($table, array($column => $position), $whereMerged);
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:39,代码来源:Db.php

示例11: deleteOldTrainings

 /**
  * @param int $trainingsMax
  */
 public static function deleteOldTrainings($trainingsMax)
 {
     $trainingsMax = (int) $trainingsMax;
     $ids = CM_Db_Db::select('cm_svm', 'id')->fetchAllColumn();
     foreach ($ids as $id) {
         $trainingsCount = CM_Db_Db::count('cm_svmtraining', array('svmId' => $id));
         if ($trainingsCount > $trainingsMax) {
             $limit = (int) ($trainingsCount - $trainingsMax);
             $deletedCount = CM_Db_Db::exec('DELETE FROM `cm_svmtraining` WHERE `svmId` = ? ORDER BY `createStamp` LIMIT ' . $limit, array($id))->getAffectedRows();
             if ($deletedCount > 0) {
                 CM_Db_Db::replace('cm_svm', array('id' => $id, 'updateStamp' => time()));
             }
         }
     }
 }
开发者ID:cargomedia,项目名称:cm,代码行数:18,代码来源:Model.php

示例12: findById

 /**
  * @param int $id
  * @return null|static
  */
 public static function findById($id)
 {
     if (!CM_Db_Db::count('cm_streamChannelArchive_video', array('id' => $id))) {
         return null;
     }
     return new static($id);
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:11,代码来源:Video.php


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