コード例 #1
0
ファイル: draw_hdb.php プロジェクト: lamphp/scws
<?php

// draw the tree by index
// default index: -1 show all tree
//
$file = $_SERVER['argv'][1] ? $_SERVER['argv'][1] : 'test.hdb';
if (strrchr($file, '.') == '.xdb') {
    require "xdb.class.php";
    $db = new XTreeDB();
} else {
    require "hdb.class.php";
    $db = new HashTreeDB();
}
$db->open($file, "r");
$db->draw(isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : -1);
$db->close();
コード例 #2
0
ファイル: sync_hdb.php プロジェクト: lamphp/scws
<?php

// draw the tree by index
// default index: -1 show all tree
//
$file = $_SERVER['argv'][1] ? $_SERVER['argv'][1] : 'test.hdb';
$index = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : 1;
if (strrchr($file, '.') == '.xdb') {
    require "xdb.class.php";
    $db = new XTreeDB();
} else {
    require "hdb.class.php";
    $db = new HashTreeDB();
}
$db->open($file, "w");
if ($index >= 0) {
    echo "Before optimize tree data:\n";
    echo "-------------------------------------------------\n";
    $db->draw($index);
}
// optimize table
$db->optimize($index);
if ($index >= 0) {
    echo "After optimize tree data:\n";
    echo "-------------------------------------------------\n";
    $db->draw($index);
}
$db->close();