Example #1
0
 /**
  * @depends testconnect
  */
 public function testinstall(SequoiaDB $sdb)
 {
     $array_install = array("install" => false);
     $sdb->install($array_install);
     $sdb->selectCS("cs_test");
     $str = $sdb->getError();
     $this->assertEquals('{"errno":0}', $str);
     $array_install = array("install" => true);
     $sdb->install($array_install);
     $array = $sdb->getError();
     $this->assertEquals(0, $array['errno']);
     $sdb->install('{ "install":false }');
     $str = $sdb->dropCollectionSpace("cs_test");
     $this->assertEquals('{"errno":0}', $str);
     $sdb->install('{ "install":true }');
     $array = $sdb->dropCollectionSpace("cs_test");
     $this->assertEquals(-34, $array["errno"]);
     $sdb->install('{ "install":false }');
     $str = $sdb->getError();
     $this->assertEquals('{"errno":-34}', $str);
 }
Example #2
0
<?php

/*
 *  In PHP, single quotation are not the pass of the compiler analysis,
 *  but double quotes are compiler analysis.
 */
// create a new connection object
echo '<p>1. connect to server</p>';
$sdb = new SequoiaDB("localhost:50000");
var_dump($sdb->getError());
if ($sdb) {
    // create a new collection space object
    echo '<p>2. create collection space foo</p>';
    $cs = $sdb->selectCS("foo");
    var_dump($sdb->getError());
    if ($cs) {
        // create a new collection object
        echo '<p>3. create collection test</p>';
        $cl = $cs->selectCollection("test");
        if ($cl) {
            // create a new list collection space cursor object
            echo '<p>4. list collection spaces</p>';
            $sdb_cursor = $sdb->listCSs();
            if ($sdb_cursor) {
                while ($arr = $sdb_cursor->getNext()) {
                    var_dump($arr);
                    echo "<br><br>";
                }
            }
            // rename this collection name
            echo '<p>5. rename this collection name</p>';
Example #3
0
 /**
  * @depends testconnect
  */
 public function testselectCS(SequoiaDB $sdb)
 {
     $cs = $sdb->selectCS("cs_test");
     $this->assertNotEmpty($cs);
     return $cs;
 }
Example #4
0
$selected = empty($_POST['selected']) ? NULL : $_POST['selected'];
$orderBy = empty($_POST['orderBy']) ? NULL : $_POST['orderBy'];
$hint = empty($_POST['hint']) ? NULL : $_POST['hint'];
$numToSkip = empty($_POST['numToSkip']) ? 0 : $_POST['numToSkip'];
$numToReturn = empty($_POST['numToReturn']) ? -1 : $_POST['numToReturn'];
$rule = empty($_POST['rule']) ? NULL : $_POST['rule'];
$indexDef = empty($_POST['indexDef']) ? NULL : $_POST['indexDef'];
$indexpName = empty($_POST['indexpName']) ? NULL : $_POST['indexpName'];
$isUnique = empty($_POST['isUnique']) ? NULL : $_POST['isUnique'];
$obj = empty($_POST['obj']) ? "" : $_POST['obj'];
$listType = empty($_POST['listType']) ? 0 : $_POST['listType'];
$pName = empty($_POST['pName']) ? NULL : $_POST['pName'];
$sequoia_db = new SequoiaDB($addr);
if ($sequoia_db) {
    if ($work == "create_coll_space") {
        $sequoia_db->selectCS($space);
        if ($sequoia_db) {
            echo "true";
        }
    } else {
        if ($work == "del_coll_space") {
            $cs = $sequoia_db->selectCS($space);
            if ($cs) {
                var_dump($cs->drop());
            }
        } else {
            if ($work == "list_coll_space") {
                $cursor = $sequoia_db->listCSs();
                if ($cursor) {
                    while ($str = $cursor->getNext()) {
                        var_dump($str);