X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FInterBase.pm;h=fd21056b9fc59446b4fa9088e1d5a77df155f51d;hb=07cda1c5a7df6656772dfd65c488c19c15126168;hp=3bce1569854e0a73aa68983a2e694a7f25cafce6;hpb=6298a324307439b76419d0f5db453b0d10f10517;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/InterBase.pm b/lib/DBIx/Class/Storage/DBI/InterBase.pm index 3bce156..fd21056 100644 --- a/lib/DBIx/Class/Storage/DBI/InterBase.pm +++ b/lib/DBIx/Class/Storage/DBI/InterBase.pm @@ -15,8 +15,8 @@ DBIx::Class::Storage::DBI::InterBase - Driver for the Firebird RDBMS =head1 DESCRIPTION This class implements autoincrements for Firebird using C as well as -L sets the limit dialect to -C and provides L support. +L and provides +L support. You need to use either the L option or @@ -31,20 +31,22 @@ L. =cut -sub _supports_insert_returning { 1 } +# set default +__PACKAGE__->_use_insert_returning (1); +__PACKAGE__->sql_limit_dialect ('FirstSkip'); sub _sequence_fetch { my ($self, $nextval, $sequence) = @_; - if ($nextval ne 'nextval') { - $self->throw_exception("Can only fetch 'nextval' for a sequence"); - } + $self->throw_exception("Can only fetch 'nextval' for a sequence") + if $nextval !~ /^nextval$/i; $self->throw_exception('No sequence to fetch') unless $sequence; - my ($val) = $self->_get_dbh->selectrow_array( -'SELECT GEN_ID(' . $self->sql_maker->_quote($sequence) . -', 1) FROM rdb$database'); + my ($val) = $self->_get_dbh->selectrow_array(sprintf + 'SELECT GEN_ID(%s, 1) FROM rdb$database', + $self->sql_maker->_quote($sequence) + ); return $val; } @@ -89,18 +91,6 @@ EOF return undef; } -# this sub stolen from DB2 - -sub _sql_maker_opts { - my ( $self, $opts ) = @_; - - if ( $opts ) { - $self->{_sql_maker_opts} = { %$opts }; - } - - return { limit_dialect => 'FirstSkip', %{$self->{_sql_maker_opts}||{}} }; -} - sub _svp_begin { my ($self, $name) = @_;