示例#1
0
<?php

/**
 * Currently all examples are in 1 file cuz this thing's nowhere near ready and
 * updating multiple files would be f*****g annoying.
 *
 * Eventually this will be split into multiple files... each hilighting a different feature
 */
require_once realpath(dirname(__FILE__)) . '/inc.php';
require_once 'Duckk/CouchDB.php';
require_once 'Duckk/CouchDB/Util.php';
$couchdb = new Duckk_CouchDB();
$randomDoc = "testing_" . substr(md5(microtime(true)), 0, 8);
print_r($couchdb->getAllDocuments('arin'));
print_r($couchdb->getAllDocumentsBySequence('arin'));
echo "------------ example doc put (id = {$randomDoc}) -------------------\n";
$doc = new Duckk_CouchDB_Document();
$doc->_id = $randomDoc;
print_r($couchdb->putDocument('arin', $doc));
echo "------------ test copying  -------------------\n";
print_r($couchdb->copyDocument('arin', "testing_16bd3b77", "testing_b3307897copy", "12-2566465478", "1-1053805331"));
echo "------------ delete the example doc ({$randomDoc}) -------------------\n";
print_r($couchdb->deleteDocument('arin', $doc->_id));
echo "------------ get my test document --------------\n";
print_r($couchdb->getDocument('arin', 'booya3'));
echo "------------LIST OF DATABASES---------------\n";
print_r($couchdb->getDatabases());
echo "------------ get rev info for my test document --------------\n";
print_r($couchdb->getDocumentRevisionList('arin', 'booya'));
echo "------------ get rev info for my test document --------------\n";
print_r($couchdb->getDocumentRevisionInfo('arin', 'booya'));