Retrieving multiple result sets

Retrieving multiple result sets

Post by Tim Gree » Sun, 31 Dec 1899 09:00:00



Hopefully this is just another newbie question and I'm missing the
obvious...

In Delphi 3, is there a way to execute a query that returns multiple results
sets and actually do something with them, or alternatively, is there a way
to execute a query and perform some action as each row is fetched (not
after)?

My problem is I'd like to let a user execute a query that they specify and
return the results.  The query may have 0, 1 or more result sets.  I'm
looking to simply format the results as text; nothing fancy, no grids or
tables.  My problem is that all the TDataSet objects assume one result set,
and there doesn't appear to be (or I can't find it) a way to get into the
actual retrieval of data; no way to hook the row fetching process.

I know how to do this if I was righting in C (w/o the BDE), or PowerBuilder
of that matter.  In both I could start fetching results, when one result set
finished, continue fetching until I exhausted all result sets.  As each row
was fetched I could do whatever I wanted with the results, perhaps storing
in multiple arrays, converting them to text and appending to a string, or
simple processing and then discarding.  But the BDE doesn't seem to give the
programmer a way to process a row at a time.

Am I missing something?  Is there anyway to do this?

TIA,
Tim Green

 
 
 

Retrieving multiple result sets

Post by Alistair Wal » Sun, 31 Dec 1899 09:00:00




Quote:>Hopefully this is just another newbie question and I'm missing the
>obvious...

>In Delphi 3, is there a way to execute a query that returns multiple results
>sets and actually do something with them, or alternatively, is there a way
>to execute a query and perform some action as each row is fetched (not
>after)?

Once you have executed the query, you can navigate between returned
records using the methods which the SQL object inherits from TDataset,
e.g. First, Last, Next, Prior.
--
Alistair Wall

 
 
 

Retrieving multiple result sets

Post by Randy Ric » Sun, 31 Dec 1899 09:00:00


I have this problem with stored procedures that return multiple sets.  I
found no way for a delphi dataset component to do this so I worked around
it.  The vcl object is designed to accept single sets.  I suppose someone
with the expertise could extend the tdataset component, maybe there is a 3rd
party product that does this.


>In Delphi 3, is there a way to execute a query that returns multiple
results
>sets and actually do something with them, or alternatively, is there a way
>to execute a query and perform some action as each row is fetched (not
>after)?

>TIA,
>Tim Green


 
 
 

1. SQL connection error after retrieving multiple result sets

To speed up access to a DB2 database I am caching the connection
(DriverManager.getConnection() Version 1.1) rather than establishing a new
one
for each query.

After 20-40 SELECT queries the JDBC drive throws a 'no enough heap memory'
exception.

Is this the driver leaking memory or is there a bug with multiple queries
through one connection?

Please email as well as post.
TIA
----------------------------------------------------------------------

Sun Certified Java Programmer  HomePage: http://www.rts.com.au/warp
                               Mobile  : 019171771 Phone: 08 92933501
PC and Internet Development    Mail    : PO Box 859 Kalamunda WA 6076

2. Q: "unknown expression type 108" ?

3. Set Precedence Against Multiple Result Sets?

4. Multi-statement

5. Retrieving Row Index as part of Result set??

6. Good Quotes (lzqzsu)

7. Retrieve the result set generated by COMPUTE clause

8. Retrieving a result set with a TQuery

9. Using vb to retrieve a result set from a function

10. Retrieving result sets from Stored Procedures using ODBC

11. Using vb to retrieve a result set from a stored procedure

12. problem when retrieving a result set from a stored procedure