|
Sorry to join late in this. The QSQPRCED API uses the SQLDA descriptor. The SQLDA data structure contains an array, which you have to lopp through to get the column data retrieved. You can also use embedded SQL with descriptor SQLDA, which makes that form of SQL dynamic. It seems James, the originator, cannot use embedded SQL. Regards, Carel Teijgeler. *********** REPLY SEPARATOR *********** On 5-7-2006 at 2:36 Larry Ducie wrote:
<snip> I'm a little confused (not that that's unusual). What do you mean
"iterate
through each column"? The ResultSet in JDBC has a next() method which positions you to the next row, at which point you do getXxx (e.g., getString, getFloat) passing either an ordinal column number or a String containing a column name to get the appropriate field from the current
row.
I don't have to iterate through the columns. </snip> OK. The comparison I was drawing was based on trying to perform two
fundamentally similar tasks:
1) Within RPG - use QSQPRCED to dynamically retrieve data from columns in
a
result set which is not known at runtime. 2) Within Java - use JDBC to dynamically retrieve data from columns in a result set which is not known at runtime. I have done both, and I believe the process is similar. Consider building
a
very basic query processor using Swing. You have a SQL scratchpad and a table to display the results. As you have no idea what the resultset will look like (because you don't know what query the user will type) you have
to
build code which simply processes each row, and for each row processes
each
column - retrieve the data, format it, and place it in a String object.
Once
done, you can display the table data. To obtain the same result in RPG I would use QSQPRCED and a couple of for-loops. I could have used the phrase "sequencially process in a looping
fashion" instead of iterate but I assumed they were the same - and iterate
takes less typing. :-)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.