Comprehensive MSAccess support over both DBD::ODBC and DBD::ADO
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC / Firebird.pm
index 6f6acdf..d4a5f50 100644 (file)
@@ -2,8 +2,10 @@ package DBIx::Class::Storage::DBI::ODBC::Firebird;
 
 use strict;
 use warnings;
-use base qw/DBIx::Class::Storage::DBI::InterBase/;
+use base 'DBIx::Class::Storage::DBI::InterBase';
 use mro 'c3';
+use Try::Tiny;
+use namespace::clean;
 
 =head1 NAME
 
@@ -26,6 +28,8 @@ under L<Catalyst>.
 
 =cut
 
+__PACKAGE__->datetime_parser_type ('DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format');
+
 # XXX seemingly no equivalent to ib_time_all from DBD::InterBase via ODBC
 sub connect_call_datetime_setup { 1 }
 
@@ -35,11 +39,21 @@ sub _init { 1 }
 # ODBC uses dialect 3 by default, good
 sub _set_sql_dialect { 1 }
 
-# releasing savepoints doesn't work, but that shouldn't matter
+# releasing savepoints doesn't work for some reason, but that shouldn't matter
 sub _svp_release { 1 }
 
-sub datetime_parser_type {
-  'DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format'
+sub _svp_rollback {
+  my ($self, $name) = @_;
+
+  try {
+    $self->_dbh->do("ROLLBACK TO SAVEPOINT $name")
+  }
+  catch {
+    # Firebird ODBC driver bug, ignore
+    if (not /Unable to fetch information about the error/) {
+      $self->throw_exception($_);
+    }
+  };
 }
 
 package # hide from PAUSE
@@ -93,3 +107,4 @@ See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
 You may distribute this code under the same terms as Perl itself.
 
 =cut
+# vim:sts=2 sw=2: