index: release v1.18 with only altgr index linked
[sheet.git] / Shiar_Sheet / DB.pm
1 package Shiar_Sheet::DB;
2
3 use 5.014;
4 use warnings;
5 use DBIx::Simple;
6
7 our $VERSION = '1.00';
8
9 my @dbinfo = (
10         'DBI:Pg:dbname=sheet;host=localhost', 'sheetadmin', 'fairuse',
11 ) or die "database not configured\n";
12 our $db;
13
14 sub connect {
15         return $db if $db and $db->dbh->ping;
16         $db = DBIx::Simple->new(@dbinfo[0..2], {
17                 RaiseError => 1,
18                 pg_enable_utf8 => 1,
19         });
20         $db->abstract->{array_datatypes}++;
21         return $db;
22 }
23
24 1;