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