minor cleanups
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase.pm
index 2f27688..8e65c99 100644 (file)
@@ -140,49 +140,26 @@ sub _is_lob_type {
   $type && $type =~ /(?:text|image|lob|bytea|binary)/i;
 }
 
-# Move TEXT/IMAGE column to the end of select list, and make sure there is only
-# one.
+## This will be useful if we ever implement BLOB filehandle inflation and will
+## need to use the API, but for now it isn't.
 #
-# work in progress
-#
-# * column indexes need to be fixed if @$select is reordered, not sure if that's
-# possible
-# * needs to handle hashrefs
-# * for some reason tests pass without this, even though documentation says
-# blobs should be at the end of the select list
-# * needs to at least croak for multiple blobs
-#
-#sub _select_args {
-#  my ($self, $ident, $select) = splice @_, 0, 3;
-#
-#  my ($alias2src, $rs_alias) = $self->_resolve_ident_sources($ident);
-#  my $name_sep = $self->_sql_maker_opts->{name_sep} || '.';
+#sub order_columns_for_select {
+#  my ($self, $source) = @_;
 #
 #  my (@non_blobs, @blobs);
 #
-#  for my $col (@$select) {
-#    if (ref $col) {
-## XXX should handle hashrefs too
-#      push @non_blobs, $col;
-#      next;
-#    }
-#
-#    $col =~ s/^([^\Q${name_sep}\E]*)\Q${name_sep}\E//;
-#    my $alias    = $1 || $rs_alias;
-#    my $rsrc     = $alias2src->{$alias};
-#    my $datatype = $rsrc && $rsrc->column_info($col)->{data_type};
-# 
-#    if ($self->_is_lob_type($datatype)) {
+#  for my $col ($source->columns) {
+#    if ($self->_is_lob_type($source->column_info($col)->{data_type})) {
 #      push @blobs, $col;
 #    } else {
 #      push @non_blobs, $col;
 #    }
 #  }
 #
-#  croak "cannot select more than a one TEXT/IMAGE column"
+#  croak "cannot select more than a one TEXT/IMAGE column at a time"
 #    if @blobs > 1;
 #
-#  $self->next::method($ident, [@non_blobs, @blobs], @_);
+#  return (@non_blobs, @blobs);
 #}
 
 # override to handle TEXT/IMAGE
@@ -345,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;
@@ -378,12 +358,6 @@ support.
 See L</connect_call_blob_setup> for a L<DBIx::Class::Storage::DBI/connect_info>
 setting you need to work with C<IMAGE> columns.
 
-Due to limitations in L<DBD::Sybase> and this driver, it is only possible to
-select one C<TEXT> or C<IMAGE> 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<TEXT/IMAGE> column at the end of the list.
-
 =head1 AUTHORS
 
 See L<DBIx::Class/CONTRIBUTORS>.