Subject: | In get_table_definition(), should crock if no results where returned from $sth->fetchall_arrayref |
Consider the following code snippet:
use Oracle::Schema qw(:all);
my ($tnsname, $user, $passwd)=('TNS','USER','PASSWD');
my $dbh = DBI->connect("dbi:Oracle:$tnsname", $user, $passwd, {
AutoCommit =>
my $cs = "$user/$passwd\@$tnsname";
my $table_name = 'user_tables';
my $obj = Oracle::Schema->new(cs=>$cs,tn=>$table_name);
my
($cns,$df1,$cmt)=$obj>get_table_definition($dbh,$table_name,'','HASH');
If 'user_tables' doesn't exist or the user passed to DBI doesn't have
privileges for reading its metadata, the code would take a dive at:
Schema.pm:259:$msg =~ s/,/, /g;
Subject: | Schema.pm.diff |
--- /home/jess/scripts/modified_cpan_modules/Schema.pm 2011-11-17 11:22:14.000000000 +0200
+++ /home/jess/scripts/modified_cpan_modules/Schema.pm.new 2011-11-17 11:25:03.000000000 +0200
@@ -254,12 +254,11 @@
#
# 2. construct column name list
my $r = ${$arf}[0][0];
+ croak "ERR: $q didn't return any results :(" if ! defined $r;
for my $i (1..$#{$arf}) { $r .= ",${$arf}[$i][0]"; }
$msg = $r;
- if (defined $msg){
- $msg =~ s/,/, /g;
- $self->echoMSG(" $msg", 5);
- }
+ $msg =~ s/,/, /g;
+ $self->echoMSG(" $msg", 5);
#
# 3. get column comments
$q = "SELECT column_name, comments\n FROM user_col_comments";