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


PHP Mongo::dropDB方法代码示例

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


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

示例1: testDropDB

 public function testDropDB()
 {
     $m = new Mongo();
     $mem = memory_get_usage(true);
     for ($i = 0; $i < 10000; $i++) {
         $m->dropDB("phpunit");
     }
     $this->assertEquals($mem, memory_get_usage(true));
     $db = $m->selectDB("phpunit");
     for ($i = 0; $i < 10000; $i++) {
         $m->dropDB($db);
     }
 }
开发者ID:kph11,项目名称:mongo-php-driver,代码行数:13,代码来源:MongoMemTest.php

示例2: tearDown

 protected function tearDown()
 {
     if (!empty($this->_connectionString) && extension_loaded('mongo')) {
         $this->_model = null;
         $connection = new \Mongo($this->_connectionString);
         $connection->dropDB($this->_dbName);
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:8,代码来源:MongoDbTest.php

示例3: dropDb

 /**
  * Drops a database
  */
 public function dropDb()
 {
     $this->mongo->drop();
     return;
     if (!isset($this->_db)) {
         $this->_db = $this->_mongo();
     }
     $this->_db->dropDB($this->mongo);
 }
开发者ID:doganomer,项目名称:RidderFinal,代码行数:12,代码来源:model.php

示例4: dropDatabase

 /** @proxy */
 public function dropDatabase($database)
 {
     if ($this->eventManager->hasListeners(Events::preDropDatabase)) {
         $this->eventManager->dispatchEvent(Events::preDropDatabase, new EventArgs($this, $database));
     }
     $this->initialize();
     $result = $this->mongo->dropDB($database);
     if ($this->eventManager->hasListeners(Events::postDropDatabase)) {
         $this->eventManager->dispatchEvent(Events::postDropDatabase, new EventArgs($this, $result));
     }
     return $result;
 }
开发者ID:ud223,项目名称:yj,代码行数:13,代码来源:Connection.php

示例5: testDropDB

 public function testDropDB()
 {
     $this->object->connect();
     $c = $this->object->selectCollection("temp", "foo");
     $c->insert(array('x' => 1));
     $this->object->dropDB("temp");
     $this->assertEquals($c->findOne(), NULL);
     $db = $this->object->selectDB("temp");
     $c->insert(array('x' => 1));
     $this->object->dropDB($db);
     $this->assertEquals($c->findOne(), NULL);
 }
开发者ID:salathe,项目名称:mongo-php-driver,代码行数:12,代码来源:MongoTest.php

示例6: testDropDB

 public function testDropDB()
 {
     $this->object->connect();
     $c = $this->object->selectCollection("temp", "foo");
     $result = $c->db->command(array("ismaster" => 1));
     if (!$result['ismaster']) {
         $this->markTestSkipped("can't test writes on slave");
         return;
     }
     $c->insert(array('x' => 1));
     $this->object->dropDB("temp");
     $this->assertEquals($c->findOne(), NULL);
     $db = $this->object->selectDB("temp");
     $c->insert(array('x' => 1));
     $this->object->dropDB($db);
     $this->assertEquals($c->findOne(), NULL);
 }
开发者ID:rosarion,项目名称:mongo-php-driver,代码行数:17,代码来源:MongoTest.php

示例7: clean

 /**
  * Clean some cache records (protected method used for recursive stuff)
  *
  * Available modes are :
  * \Zend_Cache::CLEANING_MODE_ALL (default)    => remove all cache entries ($tags is not used)
  * \Zend_Cache::CLEANING_MODE_OLD              => remove too old cache entries ($tags is not used)
  * \Zend_Cache::CLEANING_MODE_MATCHING_TAG     => remove cache entries matching all given tags
  *                                               ($tags can be an array of strings or a single string)
  * \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
  *                                               ($tags can be an array of strings or a single string)
  * \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
  *                                               ($tags can be an array of strings or a single string)
  *
  * @param  string $dir  Directory to clean
  * @param  string $mode Clean mode
  * @param  array  $tags Array of tags
  * @throws \Zend_Cache_Exception
  * @return boolean True if no problem
  */
 public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
 {
     switch ($mode) {
         case \Zend_Cache::CLEANING_MODE_ALL:
             return $this->_conn->dropDB($this->_options['dbname']);
             break;
         case \Zend_Cache::CLEANING_MODE_OLD:
             return $this->_collection->remove(['expire' => ['$lt' => time()]]);
             break;
         case \Zend_Cache::CLEANING_MODE_MATCHING_TAG:
             return $this->_collection->remove(['t' => ['$all' => $tags]]);
             break;
         case \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
             return $this->_collection->remove(['t' => ['$nin' => $tags]]);
             break;
         case \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
             return $this->_collection->remove(['t' => ['$in' => $tags]]);
             break;
         default:
             \Zend_Cache::throwException('Invalid mode for clean() method');
             break;
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:42,代码来源:Mongodb.php


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