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


PHP Mongo::lastError方法代码示例

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


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

示例1: testConstruct

 public function testConstruct()
 {
     $m = new Mongo("localhost:27017,localhost:27018", false);
     $m->pairConnect();
     $c = $m->selectCollection("phpunit", "test");
     $c->insert(array("foo", "bar"));
     $left = new Mongo("localhost:27017");
     $left->selectCollection("foo", "bar")->insert(array('x' => 1));
     $lerr = $left->lastError();
     $right = new Mongo("localhost:27018");
     $right->selectCollection("foo", "bar")->insert(array('x' => 1));
     $rerr = $right->lastError();
 }
开发者ID:kph11,项目名称:mongo-php-driver,代码行数:13,代码来源:MongoPairTest.php

示例2: testForceError

 /**
  * @expectedException PHPUnit_Framework_Error
  */
 public function testForceError() {
     $m = new Mongo();
     $m->forceError();
     $err = $m->lastError();
     $this->assertNotNull($err['err']);
     $this->assertEquals($err['n'], 0);
     $this->assertEquals((bool)$err['ok'], true);
 }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:11,代码来源:MongoTest.php

示例3: fopen

            $people[array_rand($people)][$factorName] = true;
        }
    }
    return $people;
}
// Density.csv says how many people are within each tract of land
$handle = fopen('density.csv', 'r');
while (($data = fgetcsv($handle)) !== FALSE) {
    $populations[substr($data[1], 13)] = (int) $data[2];
}
// This XML file contains data about the shapes of these tracts
$tracts = simplexml_load_file('2010gztract_13.kml');
$pplcnt = 0;
foreach ($tracts->Document->Placemark as $PUMA) {
    // Not great XML design on their part, using regex to pull out the tract ID to match the two datasets
    preg_match('/\\<td\\>(.+)\\<\\/td\\>/', $PUMA->description[0], $matches);
    $population = $populations[$matches[1]];
    // Space-separated list of coordinates within XML object
    $polyline = explode(' ', $PUMA->Polygon[0]->outerBoundaryIs[0]->LinearRing[0]->coordinates);
    // Remove the last element which is a " "
    array_pop($polyline);
    if (count($polyline) > 1) {
        $people = insertNeighborhood($population, $polyline);
        $database->weatherhack->people->batchInsert($people);
        $pplcnt = $pplcnt + count($people);
        echo "inserted {$pplcnt}...  ";
        usleep(100);
    }
}
var_dump($database->lastError());
开发者ID:mronemous,项目名称:weatherhack,代码行数:30,代码来源:generate.php


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