Below is the code I’m using to run the query, parse the result set, and parse the rows (respectively)
$exec_ret = $DBS->SQLExecSQL($STMT); while ($DBS->SQLFetch() == *PLibdata::RET_OK) { $rowfetch = $DBS->{Row}->GetCharValue($colname[$i]); }
Can I grab the column/field name of a temp table using similar syntax? $colname[$i] is predefined at the top to hold the column/field names. This is hard-coded right now, but I would rather automate it by pushing values into $colname inside of a loop that runs before the rows are parsed.
What module are you using for database access? I don’t recognize the method names.
If you’re using DBI, you can get the column names from the statement handle after executing it:
There are 3 versions of the column names:
NAMEgives the column names as the database returns them,NAME_lcconverts them to all lower case, andNAME_ucconverts them to all upper case. If you care about database independence, I suggest you avoidNAMEand use one of the other two.