sbisbee/sag-js — Issue #4: createDatabase() Exception
Author: codazoda
Created: 2012-03-05 16:52:11+00:00
State: open

When trying to create a database, the createDatabase() method always returns an exception. It says that the database already exists, even when it does not. Here's a small bit of example code to reproduce the problem.

This code connects to localhost, pulls a list of databases (test not listed), creates the 'joels_test_db' database, then deletes it. This code always throws an exception on the creation of the test DB, even though it doesn't originally exist and is created by the call.

\n";

// Get a list of databases
$databases = $sag->getAllDatabases()->body;
print_r($databases);

// Create a database
try {
$sag->createDatabase('joels_test_db');
} catch(Exception $e) {
echo 'Error: ' . $e->getMessage() . "\n";
}

// Get a list of databases
$databases = $sag->getAllDatabases()->body;
print_r($databases);

// Delete a database
try {
$sag->deleteDatabase('joels_test_db');
} catch(Exception $e) {
echo 'Error: ' . $e->getMessage() . "\n";
}

// Get a list of databases
$databases = $sag->getAllDatabases()->body;
print_r($databases);

echo "

\n";

?>