コード例 #1
0
ファイル: Fs.php プロジェクト: dejanfx/nov-framework
 /**
  * 
  * @param string $cdbId
  * @param string $db 
  * @return \Nov\CouchDb\Fs
  */
 static function factory($cdbId, $db = null)
 {
     $db = is_null($db) ? self::$_db : $db;
     return new self(Nov\CouchDb::factory($cdbId)->db($db));
 }
コード例 #2
0
ファイル: test1.php プロジェクト: dejanfx/nov-framework
<?php

echo "<pre>";
require_once "Nov/Loader.php";
Nov\Loader::init();
use Nov\CouchDb;
$cdb = new CouchDb('localhost', 5984);
$cdb->db('users');
$nombre = $cdb->db('users')->select('gonzalo')->asObject()->name;
$apellido = $cdb->db('users')->select('gonzalo')->asObject()->surname;
echo "Hola {$nombre} {$apellido}.<p/>";
//echo "Apellido = ". $gonzaloCdb->select('gonzalo')->asObject()->name . "<p/>";
$cdb = CouchDb::factory(NovConf::CDB1)->db('users');
echo "INSERT\n";
try {
    var_dump($cdb->insert('xxx', array('name' => 'xxx'))->asObject());
} catch (CouchDb\Exception\DupValOnIndex $e) {
    echo "Already created\n";
}
echo "SELECT\n";
var_dump($cdb->select('xxx')->asObject());
echo "UPDATE\n";
var_dump($cdb->update('xxx', array('name' => 'xxx1'))->asObject());
echo "SELECT\n";
var_dump($cdb->select('xxx')->asObject());
echo "DELETE\n";
var_dump($cdb->delete('xxx')->asObject());
var_dump($cdb->view('auth', 'email', '*****@*****.**')->asObject());
echo "</pre>";