Skip to content

Commit

Permalink
refactor code needing version
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Axel 'fREW' Schmidt committed Jun 7, 2013
1 parent 84d8c2a commit eca657d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/DBIx/Class/Storage/DBI/MSSQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ __PACKAGE__->datetime_parser_type (

__PACKAGE__->new_guid('NEWID()');

sub _sql_server_2005_or_higher {
if (exists $_[0]->_server_info->{normalized_dbms_version}) {
if ($_[0]->_server_info->{normalized_dbms_version} >= 9) {
return 1
} else {
return 0
}
}
return undef;
}

sub _prep_for_execute {
my $self = shift;
my ($op, $ident, $args) = @_;
Expand Down Expand Up @@ -151,12 +162,9 @@ sub sqlt_type { 'SQLServer' }
sub sql_limit_dialect {
my $self = shift;

my $supports_rno = 0;
my $supports_rno = $self->_sql_server_2005_or_higher;

if (exists $self->_server_info->{normalized_dbms_version}) {
$supports_rno = 1 if $self->_server_info->{normalized_dbms_version} >= 9;
}
else {
unless (defined $supports_rno) {
# User is connecting via DBD::Sybase and has no permission to run
# stored procedures like xp_msver, or version detection failed for some
# other reason.
Expand Down

0 comments on commit eca657d

Please sign in to comment.