Commit | Line | Data |
dff4c3a3 |
1 | package DBIx::Class::Storage::DBI::ODBC::Firebird; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use base qw/DBIx::Class::Storage::DBI::InterBase/; |
6 | use mro 'c3'; |
7 | |
dff4c3a3 |
8 | =head1 NAME |
9 | |
10 | DBIx::Class::Storage::DBI::ODBC::Firebird - Driver for using the Firebird RDBMS |
11 | through ODBC |
12 | |
d1fc96c7 |
13 | =head1 DESCRIPTION |
dff4c3a3 |
14 | |
32323fc2 |
15 | Most functionality is provided by L<DBIx::Class::Storage::DBI::Interbase>, see |
dff4c3a3 |
16 | that module for details. |
17 | |
90489c23 |
18 | To build the ODBC driver for Firebird on Linux for unixODBC, see: |
19 | |
20 | L<http://www.firebirdnews.org/?p=1324> |
21 | |
d1fc96c7 |
22 | This driver does not suffer from the nested statement handles across commits |
23 | issue that the L<DBD::InterBase|DBIx::Class::Storage::DBI::InterBase> based |
24 | driver does. This makes it more suitable for long running processes such as |
25 | under L<Catalyst>. |
26 | |
1ae0a36c |
27 | =cut |
28 | |
6f7a118e |
29 | __PACKAGE__->datetime_parser_type ('DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format'); |
30 | |
c5827074 |
31 | # XXX seemingly no equivalent to ib_time_all from DBD::InterBase via ODBC |
32323fc2 |
32 | sub connect_call_datetime_setup { 1 } |
1ae0a36c |
33 | |
9633951d |
34 | # we don't need DBD::InterBase-specific initialization |
35 | sub _init { 1 } |
36 | |
37 | # ODBC uses dialect 3 by default, good |
38 | sub _set_sql_dialect { 1 } |
39 | |
5c6ed0b5 |
40 | # releasing savepoints doesn't work, but that shouldn't matter |
41 | sub _svp_release { 1 } |
42 | |
c5827074 |
43 | package # hide from PAUSE |
44 | DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format; |
45 | |
46 | # inherit parse/format date |
47 | our @ISA = 'DBIx::Class::Storage::DBI::InterBase::DateTime::Format'; |
48 | |
49 | my $timestamp_format = '%Y-%m-%d %H:%M:%S'; # %F %T, no fractional part |
50 | my $timestamp_parser; |
51 | |
52 | sub parse_datetime { |
53 | shift; |
54 | require DateTime::Format::Strptime; |
55 | $timestamp_parser ||= DateTime::Format::Strptime->new( |
56 | pattern => $timestamp_format, |
57 | on_error => 'croak', |
58 | ); |
59 | return $timestamp_parser->parse_datetime(shift); |
60 | } |
61 | |
62 | sub format_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->format_datetime(shift); |
70 | } |
71 | |
1ae0a36c |
72 | 1; |
73 | |
32323fc2 |
74 | =head1 CAVEATS |
75 | |
a499b173 |
76 | =over 4 |
77 | |
78 | =item * |
79 | |
32323fc2 |
80 | This driver (unlike L<DBD::InterBase>) does not currently support reading or |
81 | writing C<TIMESTAMP> values with sub-second precision. |
82 | |
a499b173 |
83 | =back |
84 | |
dff4c3a3 |
85 | =head1 AUTHOR |
86 | |
87 | See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>. |
88 | |
89 | =head1 LICENSE |
90 | |
91 | You may distribute this code under the same terms as Perl itself. |
92 | |
93 | =cut |