Beispiel #1
0
}
echo 'Connecting as root...' . PHP_EOL;
try {
    $connect = $db->connect('root', $rootPassword);
} catch (OrientDBException $e) {
    die('Failed to connect(): ' . $e->getMessage());
}
try {
    $exists = $db->DBExists($dbName);
} catch (OrientDBException $e) {
    die('Failed to execute DBExists(): ' . $e->getMessage());
}
if ($exists) {
    echo 'Deleting DB (in case of previous run failed)...' . PHP_EOL;
    try {
        $db->DBDelete($dbName);
    } catch (OrientDBException $e) {
        die('Failed to DBDelete(): ' . $e->getMessage());
    }
}
echo 'Creating DB...' . PHP_EOL;
try {
    $result = $db->DBCreate($dbName, OrientDB::DB_TYPE_LOCAL);
    echo 'Opening DB...' . PHP_EOL;
    $clusters = $db->DBOpen($dbName, 'writer', 'writer');
    foreach ($clusters['clusters'] as $cluster) {
        if ($cluster->name === $clusterName) {
            $clusterID = $cluster->id;
        }
    }
    echo 'Create record...' . PHP_EOL;