In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions
Moderators: gto , EgonHugeist
josimarz
Junior Boarder
Posts: 41 Joined: 14.09.2009, 17:29
Location: Brazil
Post
by josimarz » 17.09.2012, 22:03
Hello,
I'm using the ZDBC API to execute queries. Like this:
Code: Select all
var
Rs: IZResultSet;
begin
Rs :=
ZConn.DbcConnection.CreateStatement.ExecuteQuery('SELECT A FROM T');
while Rs.Next do
begin
//
end;
At one point I wish to return to the top of the resultset, before the first record:
But does not work. The pointer remains in the same position. The following works:
That would be a bug?
Database: mysql 5.5.25
ZEOS: 6.6.6
Best regards,
Josimar
EgonHugeist
Zeos Project Manager
Posts: 1936 Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 20.09.2012, 15:11
josimarz ,
The walk through the resultsets has dependencies to the scrolltype they have. Some are NativeResultset/ForwardOnly and others are CachedResultset/scrollintensive. This will be decided from the the PlainDriver or an Info.Value[useresult]=True.
But i have no idea about 6.6 and if that really is a bug or a wanted behavior. Did you test it with Zeos7 too?
josimarz
Junior Boarder
Posts: 41 Joined: 14.09.2009, 17:29
Location: Brazil
Post
by josimarz » 25.09.2012, 14:56
EgonHugeist ,
The solution is change the
ResultSetConcurrency property to
rcUpdatable :
Code: Select all
var
Conn: IZConnection;
Stmt: IZStatement;
Rs: IZResultSet;
begin
{...}
Stmt := Conn.CreateStatement;
Stmt.SetResultSetConcurrency(rcUpdatable); // solution
Rs := Stmt.ExecuteQuery('SELECT A FROM T');
Rs.Last;
Writeln('Record count: ', Rs.GetRow);
Rs.BeforeFirst; // work!
while Rs.Next do
Writeln(Rs.GetString(1));
end;
I have not tested on version 7.
Best regards,
Josimar
EgonHugeist
Zeos Project Manager
Posts: 1936 Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 25.09.2012, 15:39
josimarz ,
well a updateable resultset needs a scrollable cursor.... Great hint.