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)
####
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);
####
[rval (cmsParms)(1)[Extra:][Type:char(100)][Field:pKey][Default:][Null:NO][Key:PRI]]