__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
- _server_info/
+ __server_info/
);
# the values for these accessors are picked out (and deleted) from
$info{dbms_ver} = $dbms_ver if defined $dbms_ver;
- $self->_server_info(\%info);
+ $self->__server_info(\%info);
return \%info;
}
+sub _server_info {
+ my $self = shift;
+
+ $self->_get_dbh;
+
+ return $self->__server_info(@_);
+}
+
sub _determine_driver {
my ($self) = @_;
sub sqlt_type { 'SQLServer' }
-sub _get_mssql_version {
- my $self = shift;
-
- my $data = $self->_get_dbh->selectrow_hashref('xp_msver ProductVersion');
-
- if ($data->{Character_Value} =~ /^(\d+)\./) {
- return $1;
- } else {
- $self->throw_exception(q{Your ProductVersion's Character_Value is missing or malformed!});
- }
-}
-
sub sql_maker {
my $self = shift;
unless ($self->_sql_maker) {
unless ($self->{_sql_maker_opts}{limit_dialect}) {
- my $version = eval { $self->_get_mssql_version; } || 0;
+
+ my ($version) = $self->_server_info->{dbms_ver} =~ /^(\d+)/;
+ $version ||= 0;
$self->{_sql_maker_opts} = {
limit_dialect => ($version >= 9 ? 'RowNumberOver' : 'Top'),
}
}
-sub _get_mssql_version {
- my $self = shift;
-
- my ($version) = $self->_server_info->{dbms_ver} =~ /^(\d+)/;
-
- return $version;
-}
-
1;
=head1 AUTHOR
$sqltargs ||= {};
- my $sqlite_version = $self->_get_dbh->{sqlite_version};
+ my $sqlite_version = $self->_server_info->{dbms_ver};
# numify, SQLT does a numeric comparison
$sqlite_version =~ s/^(\d+) \. (\d+) (?: \. (\d+))? .*/${1}.${2}/x;
$dbh->do('ROLLBACK');
}
+sub _populate_server_info {
+ my $self = shift;
+
+ my $info = $self->next::method(@_);
+
+ my $product_version = $self->_get_dbh->selectrow_hashref('xp_msver ProductVersion');
+
+ if ((my $version = $data->{Character_Value}) =~ /^(\d+)\./) {
+ $info->{dbms_ver} = $version;
+ } else {
+ $self->throw_exception(q{
+MSSQL Version Retrieval Failed, Your ProductVersion's Character_Value is missing
+or malformed!
+ });
+ }
+
+ return $info;
+}
+
1;
=head1 NAME