phatduckk / Duckk_CouchDB

A PHP CouchDB Library

This URL has Read+Write access

Arin Sarkissian (author)
Thu Jun 11 21:44:55 -0700 2009
commit  8014dd2c723e32c1871da629d9e05790ae837534
tree    aeb247cae06a27101cc861c5c056da1bb876eed1
parent  f25ea4e8091613ad91f2b747ba8a2a7b4dfcc593
name age message
directory Duckk_CouchDB/ Loading commit data...
file README
directory examples/
README
CouchDB Library coming soon...

SETUP:

* install CouchDB & start it ;-)
* make sure you have the Duckk_SimpleHTTP/ folder from Duckk_SimpleHttp in your include_path
    * download that from http://github.com/phatduckk/Duckk_SimpleHTTP/tree/master
* download this package and make sure you have the Duckk_CouchDB/ folder from Duckk_CouchDB in your include_path
    * download this from http://github.com/phatduckk/Duckk_CouchDB/tree/master
    
You include_path will look something like
    PEAR/
    YourIncPath/
    Duckk_CouchDB/
    Duckk_SimpleHTTP/
    
echo get_include_path();
// someStuff:Duckk_CouchDB:Duckk_SimpleHTTP:YourIncPath:PEAR

---------------------------- EXAMPLE ------------------------------
$couchdb      = new Duckk_CouchDB();
$randomDBName = 'testing' . md5(microtime(true));

print_r($couchdb->getDatabases());
// shows array of db names

var_dump($couchdb->createDatabase($randomDBName));
// should return TRUE assuming $randomDBName doesnt exist

try {
    $couchdb->createDatabase($randomDBName);    
} catch (Exception $e) {
    print_r($e);
    // should print the exception cuz we already created $randomDBName
}

var_dump($couchdb->deleteDatabase($randomDBName));
// should return TRUE cuz it successfully deleted $randomDBName

try {
    $couchdb->deleteDatabase($randomDBName);    
} catch (Exception $e) {
    print_r($e);
    // should print the exception cuz $randomDBName no longer exists
}