__PACKAGE__->mk_group_accessors('simple' =>
qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts _conn_pid
- _conn_tid transaction_depth _dbh_autocommit _driver_determined savepoints/
+ _conn_tid transaction_depth _dbh_autocommit _driver_determined savepoints
+ _server_info/
);
# the values for these accessors are picked out (and deleted) from
$self->{transaction_depth} = $self->_dbh_autocommit ? 0 : 1;
$self->_run_connection_actions unless $self->{_in_determine_driver};
+
+ $self->_get_server_info;
}
sub _run_connection_actions {
$self->_do_connection_actions(connect_call_ => $_) for @actions;
}
+sub _get_server_info {
+ my $self = shift;
+ my %info;
+
+ $info{dbms_ver} = $self->_get_dbh->get_info(18);
+
+ $self->_server_info(\%info);
+
+ return \%info;
+}
+
sub _determine_driver {
my ($self) = @_;
sub _get_mssql_version {
my $self = shift;
- my ($version) = $self->_get_dbh->get_info(18) =~ /^(\d+)/;
+ my ($version) = $self->_server_info->{dbms_ver} =~ /^(\d+)/;
return $version;
}
sub can_insert_returning {
my $self = shift;
- my $pg_ver = $self->_get_dbh->get_info(18);
-
- my ($major, $minor) = $pg_ver =~ /^(\d+)\.(\d+)/;
+ my ($major, $minor) = $self->_server_info->{dbms_ver} =~ /^(\d+)\.(\d+)/;
return 1
if ($major > 8) || ($major == 8 && $minor >= 2);
my $schema;
+require DBIx::Class::Storage::DBI::Pg;
+
+my $can_insert_returning =
+ DBIx::Class::Storage::DBI::Pg->can('can_insert_returning');
+
for my $use_insert_returning (0..1) {
no warnings qw/redefine once/;
- require DBIx::Class::Storage::DBI::Pg;
local *DBIx::Class::Storage::DBI::Pg::can_insert_returning = sub {
$use_insert_returning
};
### connect, create postgres-specific test schema
$schema = DBICTest::Schema->connect($dsn, $user, $pass);
+ $schema->storage->ensure_connected;
+
+ if ($use_insert_returning && (not $can_insert_returning->($schema->storage)))
+ {
+ diag "Your version of PostgreSQL does not support INSERT ... RETURNING.";
+ diag "*** SKIPPING FURTHER TESTS";
+ last;
+ }
drop_test_schema($schema);
create_test_schema($schema);