You know what sucks even more, not having sp_help and sp_columns (I found that out, right after I found out there was no DBI on the server, jeez.).
Anyway, please provide us(me), the sp_* less monks with a working version. Since I can't test this, I don't guarantee it, not that I would anyway, but here's a few workarounds.
First off I'd change line
my $sql = $dbh->prepare ("sp_columns $_") || die;;
to
my $sql = $dbh->prepare ("SHOW COLUMNS FROM $_") || die;
That should work without question. (note the single ; %^)
And so should this
my @tables = $dbh->ListTables;
print "<TABLE Border = 1>\n<TH>Select me!</TH>";
foreach (@tables)
{
print "<TR><TD>",checkbox(-name=>"view",-checked=>"", -value=>
+"$tables[$_]"),"</TD>";
if(! (defined $tables[$_]) )
{
print "<TD>--undef--</TD>";
}
else
{
print "<TD>$tables[$_]</TD>";
}
print "</TR>\n";
}
as opposed to
my $sql = $dbh->prepare ("sp_help") || die;;
my $sth = $sql->execute or die "no ".$DBI::errstr;
print "<TABLE Border = 1>\n<TH>Select me!</TH>";
my $THdone;
while (my $result_ref = $sql->fetchrow_hashref()){
unless ($THdone) {
foreach (sort keys %$result_ref) {
print "<TH>$_ </TH>";
}
$THdone = "yes, indeedy!";
}
print "<TR><TD>",checkbox(-name=>"view",-checked=>"", -value=>
+"$$result_r
+ef{Name}"),"</TD>";
foreach (sort keys %$result_ref) {
if (! defined $$result_ref{$_}) {print "<TD>--undef--</TD>
+";next}
print "<TD>$$result_ref{$_}</TD>";
}
print "</TR>\n";
update:
After further examination of your code, I decided to just substitute my $sql = $dbh->prepare ("sp_help") || die;
with
my $sql = $dbh->prepare ("SHOW TABLES") || die;
But then I noticed yer code did not work as advertised. I ofcourse, knowing I couldn't get my money back, went ahead and "fixed" it. I just moved the "checkbox" statement inside the loop and(once in the loop), inside the if block.
if (! defined $$result_ref{$_})
{
print "<TD>",checkbox(-name=>"view",-checked=>"", -val
+ue=>),"</TD>";
print "<TD>--undef--</TD>";
next;
}
print "<TD>",checkbox(-name=>"view",-checked=>"", -value=>
+"$$result_ref{$_}"),"</TD>";
print "<TD>$$result_ref{$_}</TD>";
You know, I was really suprised by this, especially coming from you boo.
I wonder how many people blindly ++ed your post?
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;" |