Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / SQLAnywhere.pm
index 9cdd038..9cb8306 100644 (file)
@@ -4,8 +4,8 @@ use strict;
 use warnings;
 use base qw/DBIx::Class::Storage::DBI::UniqueIdentifier/;
 use mro 'c3';
-use List::Util 'first';
-use Try::Tiny;
+use DBIx::Class::_Util 'dbic_internal_try';
+use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info';
 use namespace::clean;
 
 __PACKAGE__->mk_group_accessors(simple => qw/_identity/);
@@ -49,8 +49,8 @@ sub _prefetch_autovalues {
 
   my $values = $self->next::method(@_);
 
-  my $identity_col =
-    first { $colinfo->{$_}{is_auto_increment} } keys %$colinfo;
+  my ($identity_col) =
+    grep { $colinfo->{$_}{is_auto_increment} } keys %$colinfo;
 
 # user might have an identity PK without is_auto_increment
 #
@@ -76,7 +76,7 @@ sub _prefetch_autovalues {
     my $table_name = $source->from;
     $table_name    = $$table_name if ref $table_name;
 
-    my ($identity) = try {
+    my ($identity) = dbic_internal_try {
       $dbh->selectrow_array("SELECT GET_IDENTITY('$table_name')")
     };
 
@@ -113,7 +113,7 @@ sub select_single {
 
   my ($ident, $select) = @_;
 
-  my $col_info = $self->_resolve_column_info($ident);
+  my $col_info = fromspec_columns_info($ident);
 
   for my $select_idx (0..$#$select) {
     my $selected = $select->[$select_idx];
@@ -135,18 +135,11 @@ sub select_single {
   return @row;
 }
 
-# this sub stolen from MSSQL
-
 sub build_datetime_parser {
-  my $self = shift;
-  try {
-    require DateTime::Format::Strptime;
-  }
-  catch {
-    $self->throw_exception("Couldn't load DateTime::Format::Strptime: $_");
-  };
 
-  return DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S.%6N' );
+  require DateTime::Format::Strptime;
+
+  DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S.%6N' );
 }
 
 =head2 connect_call_datetime_setup