in reply to Re^4: Replacement for/working version of CGI::App::Plugin::BREAD ???
in thread Replacement for/working version of CGI::App::Plugin::BREAD ???
After working through a number of typos, I am getting closer. I agree, however, that the command works perfectly in MySQL. The issue is translating it to a DBI command. For my test, the MySQL command returns:
mysql> show columns in cmsParms; +--------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-----------+------+-----+---------+-------+ | pKey | char(100) | NO | PRI | NULL | | | pValue | text | NO | | NULL | | +--------+-----------+------+-----+---------+-------+ 2 rows in set (0.00 sec)
From inside my code:
my $rval = 'rval (' . $table . ')'; my $sth2 = $dbh->prepare("SHOW COLUMNS IN $table where Field=?") or die 'prepare failed'; $sth2->execute( $field ) or die 'execute failed'; if ( $sth2->err ) { $rval .= 'error: [' . $sth2->errmsg . ']'; } else { $rval .= '(' . $sth2->rows . ')'; my ($arr, @arr, %arr, $field); while ( $arr = $sth2->fetchrow_hashref ) { foreach $field ( keys %{ $arr } ) { $rval .= "[".$field.":".$arr->{ $field }."]"; } } } return($rval);
What now is returned ($rval) is:
[rval (cmsParms)(1)[Extra:][Type:char(100)][Field:pKey][Default:][Null +:NO][Key:PRI]]
This is exactly what I expected! Changes I made:
Thanks for your help!
Lee Crites
lee@critesclan.com
|
|---|