savepoints for Informix
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / Informix.pm
CommitLineData
193590c2 1package DBIx::Class::Storage::DBI::Informix;
2use strict;
3use warnings;
4
5use base qw/DBIx::Class::Storage::DBI/;
6
7use mro 'c3';
8
9__PACKAGE__->mk_group_accessors('simple' => '__last_insert_id');
10
11sub _execute {
12 my $self = shift;
13 my ($op) = @_;
14 my ($rv, $sth, @rest) = $self->next::method(@_);
15 if ($op eq 'insert') {
16 $self->__last_insert_id($sth->{ix_sqlerrd}[1]);
17 }
18 return (wantarray ? ($rv, $sth, @rest) : $rv);
19}
20
21sub last_insert_id {
22 shift->__last_insert_id;
23}
24
25sub _sql_maker_opts {
26 my ( $self, $opts ) = @_;
27
28 if ( $opts ) {
29 $self->{_sql_maker_opts} = { %$opts };
30 }
31
32 return { limit_dialect => 'SkipFirst', %{$self->{_sql_maker_opts}||{}} };
33}
34
9fb04139 35sub _svp_begin {
36 my ($self, $name) = @_;
37
38 $self->_get_dbh->do("SAVEPOINT $name");
39}
40
41# can't release savepoints
42sub _svp_release { 1 }
43
44sub _svp_rollback {
45 my ($self, $name) = @_;
46
47 $self->_get_dbh->do("ROLLBACK TO SAVEPOINT $name")
48}
49
50
193590c2 511;
52
53__END__
54
55=head1 NAME
56
57DBIx::Class::Storage::DBI::Informix - Base Storage Class for INFORMIX Support
58
59=head1 SYNOPSIS
60
61=head1 DESCRIPTION
62
63This class implements storage-specific support for Informix
64
65=head1 AUTHORS
66
67See L<DBIx::Class/CONTRIBUTORS>
68
69=head1 LICENSE
70
71You may distribute this code under the same terms as Perl itself.
72
73=cut