I am creating some scripts to verify stored procedures. These stored procedures contain print statements meant to organize data for the user.
I have gotten past getting DBD::ODBC to recognize print statements and get them output to the console without throwing an error. Now, I want to now take those SQL PRINT statements and place them in data structures in the same order that they appear on the console. Say to create a file later.
I used this code as my sample to get the statements to the console:
I don't really understand how to grab the PRINT statements being handled by my custom error handler. My question is:#CREATE THE CUSTOM ERROR HANDLER AND #DO CODE HERE THAT RETURNS PRINT STATEMENT HEADERS #MINGLED WITH RETURNS OF ROWS, I.E.: #Name #JOHN SMITH #Title #MANAGER #Department #FOO BAR #Data from Database my @sp_return_data; #Array to be populated like stored procedure output my @final_output; do { my $line; while (@sp_return_data = $sp_sth->fetchrow_array()) { $line = join (' | ', @sp_return_data) . ".\n"; push @final_output, $line; } } while ($sp_sth->{odbc_more_results});
Thank you Monks!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |