package Shiar_Sheet::DB;

use 5.014;
use warnings;
use DBIx::Simple;

our $VERSION = '1.00';

my @dbinfo = (
	'DBI:Pg:dbname=sheet;host=localhost', 'sheetadmin', 'fairuse',
) or die "database not configured\n";
our $db;

sub connect {
	return $db if $db and $db->dbh->ping;
	$db = DBIx::Simple->new(@dbinfo[0..2], {
		RaiseError => 1,
		pg_enable_utf8 => 1,
	});
	$db->abstract->{array_datatypes}++;
	return $db;
}

1;
