Update DB.php

Added two new funcktions:
 - existsDatabase($databaseName);
 - existsTable($tableName);
And fixed some bugs.