From: Rafael Kitover Date: Sun, 19 Jul 2009 23:02:19 +0000 (+0000) Subject: minor cleanups X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=234193451aa53051d0c675f7236ab8fc55f8b6b0;p=dbsrgits%2FDBIx-Class-Historic.git minor cleanups --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index 677b9f6..8e65c99 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -322,8 +322,11 @@ sub _dbh_last_insert_id { my ($self, $dbh, $source, $col) = @_; # sorry, there's no other way! - my $sth = $dbh->prepare_cached("select max($col) from ".$source->from); - return ($dbh->selectrow_array($sth))[0]; + my $sth = $self->sth("select max($col) from ".$source->from); + my ($id) = $dbh->selectrow_array($sth); + $sth->finish; + + return $id; } 1; @@ -355,12 +358,6 @@ support. See L for a L setting you need to work with C columns. -Due to limitations in L and this driver, it is only possible to -select one C or C column at a time. This is handled automatically -for tables with only one such column, if you have more than one, supply a -C<< select => [qw/col list .../] >> key to your C<< ->search >> calls, with the -single desired C column at the end of the list. - =head1 AUTHORS See L. diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm index 9d5cac7..4e62d73 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm @@ -66,7 +66,8 @@ without placeholder support =head1 DESCRIPTION If you're using this driver than your version of Sybase does not support -placeholders. You can check with: +placeholders, or your version of L is too old (you need at least +C<1.09>. You can check with: $dbh->{syb_dynamic_supported} diff --git a/t/746sybase.t b/t/746sybase.t index 62a9e52..8c0d3bf 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -171,7 +171,7 @@ SQL $last_id = $created->id if $created; my $got = eval { - $rs->search({ id => $last_id }, { select => [$type] })->single->$type + $rs->find($last_id)->$type }; diag $@ if $@; ok($got eq $binstr{$size}, "verified inserted $size $type"); @@ -187,7 +187,7 @@ SQL ok !$@, 'updated blob successfully'; diag $@ if $@; ok(eval { - $rs->search({ id => $last_id }, { select => ['blob'] })->single->blob + $rs->find($last_id)->blob } eq $new_str, "verified updated blob" ); diag $@ if $@; } @@ -212,7 +212,7 @@ SQL diag $@ if $@; my $got = eval { - $rs->search({ id => 1 }, { select => ['blob'] })->single->blob + $rs->find(1)->blob }; diag $@ if $@; ok($got eq $binstr{large}, "verified inserted large blob");