make carp_once register messages not just callsite
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / ODBC / Firebird.pm
CommitLineData
dff4c3a3 1package DBIx::Class::Storage::DBI::ODBC::Firebird;
2
3use strict;
4use warnings;
aca3b4c3 5use base qw/
6 DBIx::Class::Storage::DBI::ODBC
7 DBIx::Class::Storage::DBI::Firebird::Common
8/;
dff4c3a3 9use mro 'c3';
e02b39b4 10use Try::Tiny;
11use namespace::clean;
dff4c3a3 12
dff4c3a3 13=head1 NAME
14
15DBIx::Class::Storage::DBI::ODBC::Firebird - Driver for using the Firebird RDBMS
16through ODBC
17
d1fc96c7 18=head1 DESCRIPTION
dff4c3a3 19
e46df41a 20Most functionality is provided by
21L<DBIx::Class::Storage::DBI::Firebird::Common>, see that driver for details.
dff4c3a3 22
90489c23 23To build the ODBC driver for Firebird on Linux for unixODBC, see:
24
25L<http://www.firebirdnews.org/?p=1324>
26
d1fc96c7 27This driver does not suffer from the nested statement handles across commits
a870aa85 28issue that the L<DBD::InterBase|DBIx::Class::Storage::DBI::InterBase> or the
29L<DBD::Firebird|DBIx::Class::Storage::DBI::Firebird> based driver does. This
30makes it more suitable for long running processes such as under L<Catalyst>.
d1fc96c7 31
1ae0a36c 32=cut
33
6f7a118e 34__PACKAGE__->datetime_parser_type ('DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format');
35
e02b39b4 36# releasing savepoints doesn't work for some reason, but that shouldn't matter
90d7422f 37sub _exec_svp_release { 1 }
5c6ed0b5 38
90d7422f 39sub _exec_svp_rollback {
e02b39b4 40 my ($self, $name) = @_;
41
42 try {
43 $self->_dbh->do("ROLLBACK TO SAVEPOINT $name")
44 }
45 catch {
46 # Firebird ODBC driver bug, ignore
47 if (not /Unable to fetch information about the error/) {
48 $self->throw_exception($_);
49 }
50 };
51}
52
c5827074 53package # hide from PAUSE
54 DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format;
55
56# inherit parse/format date
57our @ISA = 'DBIx::Class::Storage::DBI::InterBase::DateTime::Format';
58
a870aa85 59my $timestamp_format = '%Y-%m-%d %H:%M:%S.%4N'; # %F %T
c5827074 60my $timestamp_parser;
61
62sub parse_datetime {
63 shift;
64 require DateTime::Format::Strptime;
65 $timestamp_parser ||= DateTime::Format::Strptime->new(
66 pattern => $timestamp_format,
67 on_error => 'croak',
68 );
69 return $timestamp_parser->parse_datetime(shift);
70}
71
72sub format_datetime {
73 shift;
74 require DateTime::Format::Strptime;
75 $timestamp_parser ||= DateTime::Format::Strptime->new(
76 pattern => $timestamp_format,
77 on_error => 'croak',
78 );
79 return $timestamp_parser->format_datetime(shift);
80}
81
1ae0a36c 821;
83
dff4c3a3 84=head1 AUTHOR
85
86See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
87
88=head1 LICENSE
89
90You may distribute this code under the same terms as Perl itself.
91
92=cut
e02b39b4 93# vim:sts=2 sw=2: