Author: REHSACK
Date: Thu Sep 20 23:52:28 2012
New Revision: 15396
Modified:
dbi/branches/sqlengine/lib/DBD/File.pm
Log:
[PATCH] Guard f_dir against using undef
undef will/should be used for stream-based databases
f_dir and stream-based should be mutually exclusive
Modified: dbi/branches/sqlengine/lib/DBD/File.pm
==============================================================================
--- dbi/branches/sqlengine/lib/DBD/File.pm (original)
+++ dbi/branches/sqlengine/lib/DBD/File.pm Thu Sep 20 23:52:28 2012
@@ -103,6 +103,7 @@
my $dir = $attr && exists $attr->{f_dir}
? $attr->{f_dir}
: File::Spec->curdir ();
+ defined $dir or return; # Stream-based databases do not have f_dir
my %attrs;
$attr and %attrs = %$attr;
delete $attrs{f_dir};
@@ -229,7 +230,7 @@
{
my ($dbh, $attrib, $value) = @_;
- if ($attrib eq "f_dir") {
+ if ($attrib eq "f_dir" && defined $value) {
-d $value or
return $dbh->set_err ($DBI::stderr, "No such directory '$value'");
File::Spec->file_name_is_absolute ($value) or
@@ -278,6 +279,7 @@
my @tables = $dbh->SUPER::get_avail_tables ();
my $dir = $dbh->{f_dir};
+ defined $dir or return; # Stream based db's cannot be queried for tables
my $dirh = Symbol::gensym ();
unless (opendir $dirh, $dir) {