Better list_all method
[ajatus.git] / plugins / ajatus / couchdb / databases / database.php
blob4d2f2d7a58abaa2842ee216a437f403298a47c63
1 <?php
2 /**
3 *
4 * Copyright (c) 2007 Jerry Jalava <jerry.jalava@gmail.com>
5 * Licensed under the GPLv3 license
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 */
10 class couchdb_databases_database extends couchdb_transport
12 public $name;
13 public $view;
14 public $document;
16 public function __construct($name, $configuration)
18 if (empty($name))
20 throw new couchdb_database_exception('No database name given!');
23 $configuration['database'] = $name;
24 parent::__construct($configuration);
26 $this->name = $name;
28 $this->view = new couchdb_views($configuration);
29 $this->document = new couchdb_documents($configuration);
32 public function &exists()
34 $this->execute(false);
35 return $this;//($this->lastStatusCode == 200);
38 public function create()
40 return $this->execute(false, 'PUT');
43 public function delete()
45 return $this->execute(false, 'DELETE');
48 public function clear_caches()
50 $this->view->clear_caches();
51 $this->document->clear_caches();