More info about RefreshQuick method

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

More info about RefreshQuick method

Post by Sergio Bertolotti » Tue 10 Apr 2007 09:29

Dear Support,

I'm a register user of SDAC 4.x ver. prof. with Borland Delphi 7 build 8.1.
This morning I download new version of it 4.00.0.5.
I test RefreshQuick method and all is OK.
But I have one question for you...
RefreshQuick method optimize the records return to the clients and reduce network traffic if I have a primary key and a timestamp field in my table, but after call it, sort order of my records in my client app still remains correctly or not ?

For example if I have a table with this metadata :

CREATE TABLE [dbo].[sergio] (
[CONTA] int IDENTITY(1, 1) NOT NULL,
[DEMO] varchar(30) COLLATE Latin1_General_CI_AS NULL,
[SYNCFIELD] timestamp NULL,
CONSTRAINT [sergio_pk] PRIMARY KEY CLUSTERED ([CONTA]),
UNIQUE ([CONTA])
)
ON [PRIMARY]
GO

and a form with a TMSQuery and TDataSource component with this property SQL's :

Select : select * from sergio order by conta
Insert :
INSERT INTO sergio
(DEMO)
VALUES
(:DEMO)
SET :CONTA = SCOPE_IDENTITY()

Update :
UPDATE sergio
SET
DEMO = :DEMO
WHERE
CONTA = :Old_CONTA

Delete :
DELETE FROM sergio
WHERE
CONTA = :Old_CONTA

Refresh SQL :
SELECT sergio.DEMO FROM sergio
WHERE
CONTA = :CONTA
order by conta

I insert a new record via insert method and after that I call post method of my TMSQuery.
After this, new value is correctly inserted in this table. If I call RefreshQuick method of TMSQuery, this refresh value from server, but sort order still remain the same.

If I have :

CONTA DEMO
1 PIPPO
2 PLUTO
3 AAAA

and positioning my cursor at conta = 1,insert a new record and call RefreshQuick I obtain :
CONTA DEMO
4 BBBB
1 PIPPO
2 PLUTO
3 AAAA

The sort order is the same. If I call Refresh method of TMSQuery now the order is correctly :
CONTA DEMO
1 PIPPO
2 PLUTO
3 AAAA
4 BBBB

There are some properties to set for obtain a valid sort order with ResfreshQuick method or this is a bug ?

In my TMSQuery I set options properties :

ReturnParams = True and
StricUpdate = True

Best regards.
Sergio Bertolotti

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 10 Apr 2007 13:59

There is no possibility to determine the correct record position when you use server side ordering with the RefreshQuick method, as the RefreshQuich method doesn't retrieve all data from server. Only modified records are retrieved. In the next SDAC build support for local sorting will be added in the RefreshQuick method, so you will be able to use the IndexFieldNames property and call the RefreshQuick method.

Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

Post by Sergio Bertolotti » Tue 10 Apr 2007 14:13

Dear EvgeniYM,

many thank's for your answer.
I understand your position.
But for me it will be very useful if there is a possibility to sorting on local PC on every clients that are connected to SQL server DB.
In your previous e-mail you write :

>In the next SDAC build support for local sorting will be added in the >RefreshQuick method, so you will be able to use the IndexFieldNames >property and call the RefreshQuick method.

For next build do you mean SDAC 4.X minor update or SDAC 5.X ?

Best regards.
Sergio Bertolotti[/quote]

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 10 Apr 2007 14:28

This functionality will be available in SDAC 4.00.0.6

Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

Post by Sergio Bertolotti » Tue 10 Apr 2007 14:43

Dear EvgeniYM,

in my previous TMSQuery component I set IndexFieldNames = CONTA before insert a new record and after this I call RefreshQuick method without call post method.
In this case local sorting is OK.
But also if I insert a new record and after this I call post method without call RefreshQuick or Refresh method of my TMSQuery, local sorting is OK.
In both this cases if I set IndexFieldNames = CONTA before call insert method, local sorting of my datasets is OK.
Is this a case or this functionality is already implemented ?

Best regards.
Sergio Bertolotti

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Wed 11 Apr 2007 12:45

Currently the RefreshQuick method doesn't support local sorting.
Support of this functionality will be added in the next build of SDAC (4.00.0.6).
In your case there were no changes made by other users. All data were added by yourself and automatically sorted.

Sergio Bertolotti
Posts: 54
Joined: Tue 02 May 2006 12:03
Location: Italy

Post by Sergio Bertolotti » Wed 11 Apr 2007 13:52

Dear EvgeniYM,

many thak's for your answer.

I stay tune for new minor release of SDAC 4.00.0.6 .

Best regards.

Sergio Bertolotti

Post Reply