1 package DBIx::Class::Storage::DBI::Sybase::ASA;
5 use base qw/DBIx::Class::Storage::DBI/;
9 __PACKAGE__->mk_group_accessors(simple => qw/
15 DBIx::Class::Storage::DBI::Sybase::ASA - Driver for Sybase SQL Anywhere
19 This class implements autoincrements for Sybase SQL Anywhere and selects the
20 RowNumberOver limit implementation.
22 You need the C<DBD::SQLAnywhere> driver that comes with the SQL Anywhere
23 distribution, B<NOT> the one on CPAN. It is usually under a path such as:
25 /opt/sqlanywhere11/sdk/perl
29 sub last_insert_id { shift->_identity }
33 my ($source, $to_insert) = @_;
35 my $supplied_col_info = $self->_resolve_column_info($source, [keys %$to_insert]);
37 my $is_identity_insert = (List::Util::first { $_->{is_auto_increment} } (values %$supplied_col_info) )
41 my $identity_col = List::Util::first {
42 $source->column_info($_)->{is_auto_increment}
45 if ((not $is_identity_insert) && $identity_col) {
46 my $dbh = $self->_get_dbh;
47 my $table_name = $source->from;
48 $table_name = $$table_name if ref $table_name;
50 my ($identity) = $dbh->selectrow_array("SELECT GET_IDENTITY('$table_name')");
52 $to_insert->{$identity_col} = $identity;
54 $self->_identity($identity);
57 return $self->next::method(@_);
63 my ( $self, $opts ) = @_;
66 $self->{_sql_maker_opts} = { %$opts };
69 return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} };
76 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
80 You may distribute this code under the same terms as Perl itself.