18th_bronzeman has asked for the wisdom of the Perl Monks concerning the following question:
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Saving SQL PRINT statements - MSSQL, SQL Server, DBD::ODBC.
by runrig (Abbot) on Sep 22, 2007 at 02:27 UTC | |
by 18th_bronzeman (Novice) on Sep 22, 2007 at 16:58 UTC | |
by runrig (Abbot) on Sep 22, 2007 at 17:12 UTC | |
|
Re: Saving SQL PRINT statements - MSSQL, SQL Server, DBD::ODBC.
by mje (Curate) on Sep 26, 2007 at 07:59 UTC |