added MongoStatement class, modified DbDriver hierarchy

This commit is contained in:
Anton Grebnev
2011-11-15 16:55:12 +04:00
parent 229a39d682
commit 5bff74f20b
8 changed files with 288 additions and 130 deletions

View File

@ -65,9 +65,15 @@ class FindMongoCommand extends MongoDbCommand
protected $fields;
protected $multiple = true;
protected function concreteExecute()
{
return $this->collection->find($this->condition, $this->fields);
if($this->multiple) {
return $this->collection->find($this->condition, $this->fields);
} else {
return $this->collection->findOne($this->condition, $this->fields);
}
}
protected function checkParams()
@ -84,7 +90,7 @@ class InsertMongoCommand extends MongoDbCommand
{
protected $data;
protected $safe;
protected $safe = true;
protected function concreteExecute()
{
@ -107,13 +113,16 @@ class UpdateMongoCommand extends MongoDbCommand
protected $data;
protected $upsert;
protected $multiple = true;
protected $safe;
protected $upsert = false;
protected $safe = true;
protected function concreteExecute()
{
return $this->collection->update($this->condition, $this->data, array('upsert' => $this->upsert, 'safe' => $this->safe));
return $this->collection->update($this->condition, $this->data,
array('multiple' => $this->multiple, 'upsert' => $this->upsert, 'safe' => $this->safe));
}
protected function checkParams()
@ -132,7 +141,7 @@ class RemoveMongoCommand extends MongoDbCommand
{
protected $condition;
protected $safe;
protected $safe = true;
protected function concreteExecute()
{