Database Object

I’m playing around with Kirby and a MySQL DB.
I’ve worked through the Cookbook, all made sense and the shortcut methods are great.
My questions are just about creating a Database object in order to utilise some of the other methods available, in my case the validateTable method.

As I have the DB details in my config.php am I fine instantiating the class like:
$myDatabase = new Database( config::get('db') );
Or is there a better way?

Also is it possible to create a global $database object much like the standard Kirby $site and $page objects?

The question is if this is necessary, because internally the table should be validate if you call db::select(), for example:

try {
  $result = Db::select('non-existing-table');
} catch (Exception $error) {
  echo $error->getMessage();

The $kirby and $site variables are not really global variables, but injected into templates/snippets (therefore they are not available in plugins etc. without using the corresponding helper methods.

You could create a Database instance of course that you make available via a helper or so, if you really need it.

Great point I hadn’t thought of that, thanks.
Creating some sort of global database instance would probably be over kill for what I need, not to mention slightly above my skill level.