OpenNext returns no records
Posted: Wed 29 Jul 2009 15:14
Hi, I have an stored proc that returns two datasets.
I'm using an UniStoredProc and when it is connected to a MS SQL database works fine, but when it is connected to a MySQL database the second dataset seems to be empty, but calling the sp from a query browser returns the both dastasets correctly.
The UnistoredProc has the fetchAll option set to false.
Code:
UniStoredProc.Open;
ShowMessage(Inttostr(UniStoredProc.RecordCount));
// Return 3
while UniStoredProc.OpenNext do
ShowMessage(Inttostr(UniStoredProc.RecordCount));
// Return 0 !!!
Objects in DB:
/*******************************************************************************
* Selected metadata objects
* -------------------------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
/*******************************************************************************
* Tables
* ------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
CREATE TABLE test (
ID Integer NOT NULL AUTO_INCREMENT,
FULL_NAME VarChar(60) NOT NULL,
PRIMARY KEY (
ID
)
) ENGINE=InnoDB;
/*
test
----
Exporting all rows
*/
INSERT INTO test (ID, FULL_NAME) VALUES (1, 'Juan');
INSERT INTO test (ID, FULL_NAME) VALUES (2, 'Pedro');
INSERT INTO test (ID, FULL_NAME) VALUES (3, 'Raul');
INSERT INTO test (ID, FULL_NAME) VALUES (4, 'Jose');
INSERT INTO test (ID, FULL_NAME) VALUES (5, 'Ramon');
INSERT INTO test (ID, FULL_NAME) VALUES (6, 'Carlos');
/* 6 row(s) exported */
/*******************************************************************************
* Stored Procedures
* -----------------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
CREATE PROCEDURE MultiDataset()
begin
select *
from test
order by full_name
limit 3;
select *
from test
order by id
limit 3;
end
/
I'm using an UniStoredProc and when it is connected to a MS SQL database works fine, but when it is connected to a MySQL database the second dataset seems to be empty, but calling the sp from a query browser returns the both dastasets correctly.
The UnistoredProc has the fetchAll option set to false.
Code:
UniStoredProc.Open;
ShowMessage(Inttostr(UniStoredProc.RecordCount));
// Return 3
while UniStoredProc.OpenNext do
ShowMessage(Inttostr(UniStoredProc.RecordCount));
// Return 0 !!!
Objects in DB:
/*******************************************************************************
* Selected metadata objects
* -------------------------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
/*******************************************************************************
* Tables
* ------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
CREATE TABLE test (
ID Integer NOT NULL AUTO_INCREMENT,
FULL_NAME VarChar(60) NOT NULL,
PRIMARY KEY (
ID
)
) ENGINE=InnoDB;
/*
test
----
Exporting all rows
*/
INSERT INTO test (ID, FULL_NAME) VALUES (1, 'Juan');
INSERT INTO test (ID, FULL_NAME) VALUES (2, 'Pedro');
INSERT INTO test (ID, FULL_NAME) VALUES (3, 'Raul');
INSERT INTO test (ID, FULL_NAME) VALUES (4, 'Jose');
INSERT INTO test (ID, FULL_NAME) VALUES (5, 'Ramon');
INSERT INTO test (ID, FULL_NAME) VALUES (6, 'Carlos');
/* 6 row(s) exported */
/*******************************************************************************
* Stored Procedures
* -----------------
* Extracted at 29/07/2009 10:57:12
******************************************************************************/
CREATE PROCEDURE MultiDataset()
begin
select *
from test
order by full_name
limit 3;
select *
from test
order by id
limit 3;
end
/