Page 1 of 1

Load one single record each cursor movement

Posted: Thu 20 May 2010 13:59
by Gianluca
(Unidac 3.0 - Delphi2010 - MySQL)
I would load (fetch) a single record from server, also if the sql select more one. In this way, I could use all properties of TUniQuery without load eg. milions of records in a sigle time. Every scroll of TDBNavigator load one record! Is it possible?

Is there a property to make this?


thank you very much

Posted: Thu 20 May 2010 14:12
by tobias_cd
Hi,
have you tried to set "SpecificOptions.Add('FetchAll=False');" and "FetchRows := 1;" ?

Posted: Fri 21 May 2010 06:40
by Dimon
Also you can set the TUniQuery.UniDirectional property to True.

Posted: Fri 21 May 2010 06:46
by Gianluca
>have you tried to set "SpecificOptions.Add('FetchAll=False');" and "FetchRows := 1;" ?
No I dind'try to set fetch=1. Thank you I will try.

>Also you can set the TUniQuery.UniDirectional property to True.
But with unidirectional can I move cursor back as well?

Anyway I'm goint to try. Thank you.

Posted: Fri 21 May 2010 07:12
by Dimon
> But with unidirectional can I move cursor back as well?

No, the UniDirectional mode doesn't allow to move cursor back. UniDirectional is used if an application does not need bidirectional access to the records in the result set.

Posted: Fri 21 May 2010 08:32
by Gianluca
>No, the UniDirectional mode doesn't allow to move cursor back. >UniDirectional is used if an application does not need bidirectional access to >the records in the result set.

I see, but a need to move back and forward.

I saw that with a grid and property FetchAll=False and FetchRows=1 it fill the grid with all records anyway.
But with a detail view (record with field on TDBEdit control) it works the same?

Posted: Fri 21 May 2010 09:29
by Dimon
When FetchAll = False, then on opening dataset the FetchRows rows will be fetched from database and control will be returned to the application. But the rest of the records will be retrieved when a data-aware component or a program requests it. In your case the DBGrid component requests as many records as it can show on display.

Posted: Thu 27 May 2010 08:28
by Gianluca
Thak you very much.
It works :)