in reply to Re^2: Writing Multiple Recordsets into a CSV file
in thread Writing Multiple Recordsets into a CSV file
That all depends on what module(s) your underlying KAP module use. Does it use DBD::Sybase or DBD::ODBC or something else entirely?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Writing Multiple Recordsets into a CSV file
by sudip_dg77 (Novice) on Apr 11, 2008 at 08:10 UTC | |
But when I run the above perl script I only get the following output: Which is only the first line of data as returned from the stored procedure. However if I run the stored procedure alone from a tool connecting to database(like for example DB Artisan or Rapid SQL) I get the following output: How do I modify my perl script so that all of the output as returned by the stored procedure as shown above can be printed? I would appreciate your help........ | [reply] [d/l] [select] |
by Corion (Patriarch) on Apr 11, 2008 at 08:20 UTC | |
Most likely, your use of {syb_more_results} is wrong. Most likely, this is because you're not using DBD::Sybase but something else. Reduce your code. Write a real small and short script that only connects to the database and fetches the results, instead of pulling in all your other in-house libraries. Throw out the following modules from your sample program:
Date::Manip likely is not an "internally developed library" anyway. After you've thrown out these, your script should basically look like:
Also, your post should have been a reply below Re: Writing Multiple Recordsets into a CSV file, where you already got a good answer and I consider it good courtesy to at least mention that others have helped you already and where they have. | [reply] [d/l] [select] |
by ikegami (Patriarch) on Apr 11, 2008 at 08:27 UTC | |
[ This post assumes you are using DBD::Sybase. ] You use
Normal use would be
The docs suggest
Not sure what this "syb_more_results" business is about, so I don't know if "Normal" is sufficient or if you need the outer loop, but what you are using now definitely looks wrong. | [reply] [d/l] [select] |
by andreas1234567 (Vicar) on Apr 11, 2008 at 08:37 UTC | |
Not sure what this "syb_more_results" business is about,It's explained in Re: Writing Multiple Recordsets into a CSV file and (of course) the DBD-Sybase docs. It got confusing when a whole new thread was started instead of following up on the existing one.
-- Andreas | [reply] |
by sudip_dg77 (Novice) on Apr 11, 2008 at 09:22 UTC | |
But the output doesn't contain any column headers and only returns the first resultset as follows: But basically what I want is that whatever the stored procedure returns(all the 7 resultsets), just to dump that on the screen with all the header columns etc. I also do not need this $VAR1 = [ ]; Basically I want to write the output as dumped by stored procedure into a .csv file which I would need for some other purpose. But before I try to write the output into the .csv file I just wanted to print the output on the screen and see how it looks. Any help? | [reply] [d/l] [select] |
by apl (Monsignor) on Apr 11, 2008 at 09:47 UTC | |
by andreas1234567 (Vicar) on Apr 11, 2008 at 09:49 UTC | |
by ikegami (Patriarch) on Apr 11, 2008 at 10:32 UTC | |
by andreas1234567 (Vicar) on Apr 11, 2008 at 08:22 UTC | |
-- Andreas | [reply] [d/l] [select] |
by derby (Abbot) on Apr 11, 2008 at 10:14 UTC | |
You still haven't told us about KAP? Does it return a DBD object? If so, which one - DBD::Sybase, DBD::Oracle or something else? Or is it a wrapper around a DBD object? If so, does KAP expose the necessary methods/members to traverse multiple result sets. Until you can tell us more about KAP, every answer here is just MJD 11900 or (my favorite) 11901.
-derby
| [reply] |
by sudip_dg77 (Novice) on Apr 11, 2008 at 15:31 UTC | |
DBI FUNCTIONS dbidata Returns connection data for initializing a DBI connection. opendbi Returns a DBI object. Se the DBI documentation for what to to with it. Usage: my $dbi = KAP::opendbi( 'SYBASE.eq_script_user' ); $dbi->do(``SELECT * FROM people WHERE nice = 'very'''); For this example to work, a configuration file called dbi.SYBASE would have to be created, and it needs to contain values for 'data_source', 'username' and 'password' data_source=SYBASE username=eq_script_user password=secret or full data_source: data_source=dbi:ODBC:ms_servosl12 username=eq_script_user password=secret or data_source=dbi:Sybase:server=SYBASE username=eq_script_user password=secret | [reply] |
by derby (Abbot) on Apr 11, 2008 at 15:43 UTC | |
by sudip_dg77 (Novice) on Apr 11, 2008 at 15:59 UTC | |
| |