More info about RefreshQuick method
Posted: 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
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