Subject RE: [IBO] TIB_Query.RefreshKeys ignores updates
Author Stuart Hunt
Viscer,
it may be a little different for your system, but we found that doing the
following works fine:

UpdateQuery.Refresh;
Updatequery.InvalidateRows;

doing both ensures that both newly inserted rows and any edits get picked
up.
HTH,
Stuart Hunt,
Senior Developer,
IdeaGen Software PLC

-----Original Message-----
From: VICSER [mailto:vicser@...]
Sent: Friday, 24 May 2002 04:49 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Query.RefreshKeys ignores updates


Situation:

Several separate client computers connected to the
same database on server.

At one computer TIB_Query (UpdateQuery) performing
INSERT, UPDATE OR DELETE on table T1.

All other computer have TIB_Query (DisplayQuery) working to
display data from table T1 by SELECT statment.

The task is DisplayQuery to reflect changes made by UpdateQuery.
Notifications about changes performed by UpdateQuery are
sent over TCP/IP through network to all clients interested
in displaying data. (DML caching is not appropriate for me).

Table is big (up to 100 000 rows) so RefreshKeys or Refresh is
more preferred method then Close-Open.

Table is like this

CREATE TABLE T1(
KEYFIELD INTEGER NOT NULL PRIMARY KEY,
F2 INTEGER,
F3 CHAR(8)
...
)


DisplayQuery.IB_Transaction.Isolation = tiCommitted
DisplayQuery.KeyLinks[0] = T1.KEYFIELD
DisplayQuery.KeyLinksAutoDefine = false
DisplayQuery.FetchWholeRows = false
DisplayQuery.AutoFetchAll = false
DisplayQuery.RefreshAction = raKeepDataPos
DisplayQuery.RequestLive = false

DisplayQuery.SQL = SELECT * FROM T1 WHERE F2=F2_PARAMETER

where F2_PARAMETER is value set in program, but stay intact
before and after refresh.

UpdateQuery.IB_Transaction.Isolation = tiCommitted
UpdateQuery.RequestLive = false


After INSERT is performed by the UpdateQuery and insert transaction
commits I'm trying to display changes using DisplayQuery.RefreshKeys.
But inserted rows are not visible by DisplayQuery until I perform
Close and Open. Neither DisplayQuery.RefreshAll nor DisplayQuery.Refresh
doesn't help too.

After UPDATE or DELETE is performed by the UpdateQuery and changes
are committed, DisplayQuery.RefreshKeys works fine - every changes
are visible.

The interesting moment is that DisplayQuery.RefreshKeys doesn't
reflect INSERTs even if DisplayQuery & UpdateQuery are working
at the same machine and more of that if DisplayQuery & UpdateQuery
are working at the same program using the same TIB_Connection
(but using different TIB_Transaction's).

I'm using
IBObjects 4.2 Hc
Firebird 1.0
Windows NT Server 4 SP6

Thanks in advance for everybody who'll help.
Best regards, vicser

mailto: vicser@...




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/