示例#1
0
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>';
            var_dump($cl->rename("big"));
            echo "<br><br>";
            // create a new list collections cursor object
            echo '<p>6. list collections</p>';
            $sdb_cursor = $sdb->listCollections();
            if ($sdb_cursor) {
                // if you want to print sting,you can set install = false
示例#2
0
$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);
                        echo "<br />";
                    }
                }
            } else {
                if ($work == "create_coll") {
                    $cs = $sequoia_db->selectCS($space);
                    $cl = $cs->selectCollection($collectname);
                    if ($cl) {
                        echo "true";
                    }
                } else {
                    if ($work == "dele_coll") {