X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FInformix.pm;h=db953d447a98c2a426d892d937556d94ad7bef1f;hb=1abccf54e92eefc27a8afb1db3878462b348157c;hp=8f230772e492b77f96bf8210d8e7d87626b638dc;hpb=d3774d9b7a75a61a74ad08d5cb682596a908d951;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Informix.pm b/lib/DBIx/Class/Storage/DBI/Informix.pm index 8f23077..db953d4 100644 --- a/lib/DBIx/Class/Storage/DBI/Informix.pm +++ b/lib/DBIx/Class/Storage/DBI/Informix.pm @@ -6,7 +6,15 @@ use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; use Scope::Guard (); -use Context::Preserve (); +use Context::Preserve 'preserve_context'; +use namespace::clean; + +__PACKAGE__->sql_limit_dialect ('SkipFirst'); +__PACKAGE__->sql_quote_char ('"'); +__PACKAGE__->datetime_parser_type ( + 'DBIx::Class::Storage::DBI::Informix::DateTime::Format' +); + __PACKAGE__->mk_group_accessors('simple' => '__last_insert_id'); @@ -26,9 +34,10 @@ sub _execute { my $self = shift; my ($op) = @_; my ($rv, $sth, @rest) = $self->next::method(@_); - if ($op eq 'insert') { - $self->__last_insert_id($sth->{ix_sqlerrd}[1]); - } + + $self->__last_insert_id($sth->{ix_sqlerrd}[1]) + if $self->_perform_autoinc_retrieval; + return (wantarray ? ($rv, $sth, @rest) : $rv); } @@ -36,29 +45,19 @@ sub last_insert_id { shift->__last_insert_id; } -sub _sql_maker_opts { - my ( $self, $opts ) = @_; - - if ( $opts ) { - $self->{_sql_maker_opts} = { %$opts }; - } - - return { limit_dialect => 'SkipFirst', %{$self->{_sql_maker_opts}||{}} }; -} - -sub _svp_begin { +sub _exec_svp_begin { my ($self, $name) = @_; - $self->_get_dbh->do("SAVEPOINT $name"); + $self->_dbh->do("SAVEPOINT $name"); } # can't release savepoints -sub _svp_release { 1 } +sub _exec_svp_release { 1 } -sub _svp_rollback { +sub _exec_svp_rollback { my ($self, $name) = @_; - $self->_get_dbh->do("ROLLBACK TO SAVEPOINT $name") + $self->_dbh->do("ROLLBACK TO SAVEPOINT $name") } sub with_deferred_fk_checks { @@ -72,8 +71,7 @@ sub with_deferred_fk_checks { $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE'); }); - return Context::Preserve::preserve_context(sub { $sub->() }, - after => sub { $txn_scope_guard->commit }); + return preserve_context { $sub->() } after => sub { $txn_scope_guard->commit }; } =head2 connect_call_datetime_setup @@ -124,10 +122,6 @@ sub connect_call_datetime_setup { $ENV{GL_DATETIME} = "%Y-%m-%d %H:%M:%S%F5"; } -sub datetime_parser_type { - 'DBIx::Class::Storage::DBI::Informix::DateTime::Format' -} - package # hide from PAUSE DBIx::Class::Storage::DBI::Informix::DateTime::Format;