From: Rafael Kitover Date: Sun, 23 Jan 2011 12:03:13 +0000 (-0500) Subject: Use a safer $dbh->get_info X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=584ea6e45cc0c7608789d3b6ea2d16151f15ed14;hp=e989099be9257b775a97dd09b4e9b8dbfec2dfcc;p=dbsrgits%2FDBIx-Class-Historic.git Use a safer $dbh->get_info --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index dfa2e1e..d6ef837 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1161,7 +1161,13 @@ sub _server_info { } sub _get_server_version { - shift->_get_dbh->get_info(18); + shift->_dbh_get_info(18); +} + +sub _dbh_get_info { + my ($self, $info) = @_; + + return try { $self->_get_dbh->get_info($info) } || undef; } sub _determine_driver { diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm b/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm index d0eb5c9..10cfcc0 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm @@ -28,7 +28,7 @@ sub _dbh_last_insert_id { # get the schema/table separator: # '.' when SQL naming is active # '/' when system naming is active - my $sep = $dbh->get_info(41); + my $sep = $self->_dbh_get_info(41); my $sth = $dbh->prepare_cached( "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM${sep}SYSDUMMY1", {}, 3); $sth->execute(); @@ -46,7 +46,7 @@ sub _sql_maker_opts { return { limit_dialect => 'FetchFirst', - name_sep => $dbh->get_info(41) + name_sep => $self->_dbh_get_info(41) }; }); } diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm index 33b53e3..88627d3 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -286,10 +286,8 @@ sub using_freetds { $dsn = '' if ref $dsn eq 'CODE'; - my $dbh = $self->_get_dbh; - return 1 if $dsn =~ /driver=FreeTDS/i - || (try { $dbh->get_info(6) }||'') =~ /tdsodbc/i; + || ($self->_dbh_get_info(6)||'') =~ /tdsodbc/i; return 0; } diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 6129755..878ece9 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -372,6 +372,7 @@ my @unimplemented = qw( get_dbms_capability set_dbms_capability _dbh_details + _dbh_get_info sql_limit_dialect sql_quote_char @@ -379,8 +380,10 @@ my @unimplemented = qw( _inner_join_to_node _group_over_selection - _prefetch_autovalues _extract_order_criteria + + _prefetch_autovalues + _max_column_bytesize _is_lob_type ); diff --git a/lib/DBIx/Class/Storage/DBI/mysql.pm b/lib/DBIx/Class/Storage/DBI/mysql.pm index ef73a1a..fcf9fbf 100644 --- a/lib/DBIx/Class/Storage/DBI/mysql.pm +++ b/lib/DBIx/Class/Storage/DBI/mysql.pm @@ -60,7 +60,7 @@ sub sql_maker { my $maker = $self->next::method (@_); # mysql 3 does not understand a bare JOIN - my $mysql_ver = $self->_get_dbh->get_info(18); + my $mysql_ver = $self->_dbh_get_info(18); $maker->{_default_jointype} = 'INNER' if $mysql_ver =~ /^3/; }