hydra/src/lib/Hydra/Model/DB.pm
Eelco Dolstra 5e6896b2d9 Turn prepared statements back on
We once turned these off (in commit
abe71a767b) because they caused the
PostgreSQL query optimizer to use very suboptimal plans.  However,
PostgreSQL 9.2 has supposedly fixed this:

  http://www.postgresql.org/docs/9.2/static/release-9-2.html

So let's try again.
2013-02-25 21:20:52 +01:00

50 lines
956 B
Perl

package Hydra::Model::DB;
use strict;
use base 'Catalyst::Model::DBIC::Schema';
sub getHydraPath {
my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra";
die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir;
return $dir;
}
sub getHydraDBPath {
my $db = $ENV{"HYDRA_DBI"};
return $db if defined $db;
my $path = getHydraPath . '/hydra.sqlite';
#warn "The Hydra database ($path) does not exist!\n" unless -f $path;
return "dbi:SQLite:$path";
}
__PACKAGE__->config(
schema_class => 'Hydra::Schema',
connect_info => {
dsn => getHydraDBPath
},
);
=head1 NAME
Hydra::Model::DB - Catalyst DBIC Schema Model
=head1 SYNOPSIS
See L<Hydra>
=head1 DESCRIPTION
L<Catalyst::Model::DBIC::Schema> Model using schema L<Hydra::Schema>
=head1 AUTHOR
Eelco Dolstra
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;