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