1 package DBIx::Class::Storage::DBI::Informix;
5 use base qw/DBIx::Class::Storage::DBI::SetConstraintsDeferred/;
10 __PACKAGE__->sql_limit_dialect ('SkipFirst');
11 __PACKAGE__->sql_quote_char ('"');
12 __PACKAGE__->datetime_parser_type (
13 'DBIx::Class::Storage::DBI::Informix::DateTime::Format'
17 __PACKAGE__->mk_group_accessors('simple' => '__last_insert_id');
21 DBIx::Class::Storage::DBI::Informix - Base Storage Class for Informix Support
25 This class implements storage-specific support for the Informix RDBMS
33 my ($rv, $sth, @rest) = $self->next::method(@_);
35 $self->__last_insert_id($sth->{ix_sqlerrd}[1])
36 if $self->_perform_autoinc_retrieval;
38 return (wantarray ? ($rv, $sth, @rest) : $rv);
42 shift->__last_insert_id;
46 my ($self, $name) = @_;
48 $self->_dbh->do("SAVEPOINT $name");
51 # can't release savepoints
52 sub _exec_svp_release { 1 }
54 sub _exec_svp_rollback {
55 my ($self, $name) = @_;
57 $self->_dbh->do("ROLLBACK TO SAVEPOINT $name")
60 =head2 connect_call_datetime_setup
64 on_connect_call => 'datetime_setup'
66 In L<connect_info|DBIx::Class::Storage::DBI/connect_info> to set the C<DATE> and
69 Sets the following environment variables:
72 GL_DATETIME="%Y-%m-%d %H:%M:%S%F5"
74 The C<DBDATE> and C<DBCENTURY> environment variables are cleared.
76 B<NOTE:> setting the C<GL_DATE> environment variable seems to have no effect
77 after the process has started, so the default format is used. The C<GL_DATETIME>
78 setting does take effect however.
80 The C<DATETIME> data type supports up to 5 digits after the decimal point for
81 second precision, depending on how you have declared your column. The full
82 possible precision is used.
84 The column declaration for a C<DATETIME> with maximum precision is:
86 column_name DATETIME YEAR TO FRACTION(5)
88 The C<DATE> data type stores the date portion only, and it B<MUST> be declared
95 You will need the L<DateTime::Format::Strptime> module for inflation to work.
99 sub connect_call_datetime_setup {
102 delete @ENV{qw/DBDATE DBCENTURY/};
104 $ENV{GL_DATE} = "%m/%d/%Y";
105 $ENV{GL_DATETIME} = "%Y-%m-%d %H:%M:%S%F5";
108 package # hide from PAUSE
109 DBIx::Class::Storage::DBI::Informix::DateTime::Format;
111 my $timestamp_format = '%Y-%m-%d %H:%M:%S.%5N'; # %F %T
112 my $date_format = '%m/%d/%Y';
114 my ($timestamp_parser, $date_parser);
118 require DateTime::Format::Strptime;
119 $timestamp_parser ||= DateTime::Format::Strptime->new(
120 pattern => $timestamp_format,
123 return $timestamp_parser->parse_datetime(shift);
126 sub format_datetime {
128 require DateTime::Format::Strptime;
129 $timestamp_parser ||= DateTime::Format::Strptime->new(
130 pattern => $timestamp_format,
133 return $timestamp_parser->format_datetime(shift);
138 require DateTime::Format::Strptime;
139 $date_parser ||= DateTime::Format::Strptime->new(
140 pattern => $date_format,
143 return $date_parser->parse_datetime(shift);
148 require DateTime::Format::Strptime;
149 $date_parser ||= DateTime::Format::Strptime->new(
150 pattern => $date_format,
153 return $date_parser->format_datetime(shift);
156 =head1 FURTHER QUESTIONS?
158 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
160 =head1 COPYRIGHT AND LICENSE
162 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
163 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
164 redistribute it and/or modify it under the same terms as the
165 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.