[Bast-commits] r9053 - in
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage: . DBI DBI/ODBC
DBI/Sybase
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Thu Mar 25 00:24:09 GMT 2010
Author: caelum
Date: 2010-03-25 00:24:09 +0000 (Thu, 25 Mar 2010)
New Revision: 9053
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
Log:
remove _get_mssql_version
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm 2010-03-24 20:49:38 UTC (rev 9052)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm 2010-03-25 00:24:09 UTC (rev 9053)
@@ -232,25 +232,15 @@
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'),
%{$self->{_sql_maker_opts}||{}}
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2010-03-24 20:49:38 UTC (rev 9052)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2010-03-25 00:24:09 UTC (rev 9053)
@@ -175,14 +175,6 @@
}
}
-sub _get_mssql_version {
- my $self = shift;
-
- my ($version) = $self->_server_info->{dbms_ver} =~ /^(\d+)/;
-
- return $version;
-}
-
1;
=head1 AUTHOR
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm 2010-03-24 20:49:38 UTC (rev 9052)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm 2010-03-25 00:24:09 UTC (rev 9053)
@@ -50,7 +50,7 @@
$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;
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm 2010-03-24 20:49:38 UTC (rev 9052)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm 2010-03-25 00:24:09 UTC (rev 9053)
@@ -55,6 +55,25 @@
$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
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2010-03-24 20:49:38 UTC (rev 9052)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2010-03-25 00:24:09 UTC (rev 9053)
@@ -19,7 +19,7 @@
__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
@@ -942,11 +942,19 @@
$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) = @_;
More information about the Bast-commits
mailing list