break; case 'create': if (!$input[1]) { echo "Error: no collection specified.\n"; break; } array_shift($input); $collection = array_shift($input); $_fields = array('id'); $fields = array(); foreach ($input as $field) { $fields[$field] = 'char(32)'; $_fields[] = $field; } $ns = new NestedSet($collection); $res = $ns->create($fields); if (!$res) { echo 'Error: ' . $ns->error . "\n"; break; } echo "Collection created.\n"; break; case 'drop': if (!$collection) { echo "Error: no collection in use.\n"; break; } echo "Are you sure you want to drop the collection '" . $collection . "'? (yes|no)\n"; $in = explode(' ', trim(fgets(STDIN))); if ($in[0] != 'yes') { echo "Aborted.\n";