Board index » delphi » Query.Post causes current record pointer to change?

Query.Post causes current record pointer to change?

I am using Delphi 4 professional (update pack3) with Oracle 7.3.   I
traced one bug down to the current record pointer changing after a
Query.Post.  Is this a bug in Delphi or am I doing something wrong?
What this bug fixed in Delphi 5?  Thanks in advance!

The following query does have lookup fields but satisfies the
conditions for an updatable query with RequestLive true.  When I'm
just editing my data and a new record has not been appended, the same
Query1.Post does not cause the current record pointer to change.  My
datamodule where the query (Query1) is defined is an auto-create form
(project options).

Query settings:

Query1.CachedUpdates = False
Query1.RequestLive = True
Query1.Filtered = False
Query1.Unidirectional = False
Query1.UpdateMode = UpdateWhereAll

Code Summary:

Database.StartTransaction
Query1.Append
<values assigned to fields>
Query1.Post

Query1.Edit     // in a procedure
<value assigned to a field>   // in a procedure
Query1.Post  // in a procedure -  current record pointer changes!

Database.Commit

 

Re:Query.Post causes current record pointer to change?


Try not using Append with SQL backends.  Append expects that the record is going
at the end and Oracle will place the record where it wants it to go
irregaurdless if you are trying to put it to the back.  Just do an Insert and
see if that helps.

Quote
Mark Huebner wrote:

> I am using Delphi 4 professional (update pack3) with Oracle 7.3.   I
> traced one bug down to the current record pointer changing after a
> Query.Post.  Is this a bug in Delphi or am I doing something wrong?
> What this bug fixed in Delphi 5?  Thanks in advance!

> The following query does have lookup fields but satisfies the
> conditions for an updatable query with RequestLive true.  When I'm
> just editing my data and a new record has not been appended, the same
> Query1.Post does not cause the current record pointer to change.  My
> datamodule where the query (Query1) is defined is an auto-create form
> (project options).

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:Query.Post causes current record pointer to change?


I tried changing the Query.Append to a Query.Insert and the current
record pointer still changed on the Post.  Any other ideas?

On Sat, 26 Feb 2000 13:01:31 -0500, "Jeff Overcash (TeamB)"

Quote
<overc...@onramp.net> wrote:
>Try not using Append with SQL backends.  Append expects that the record is going
>at the end and Oracle will place the record where it wants it to go
>irregaurdless if you are trying to put it to the back.  Just do an Insert and
>see if that helps.

Re:Query.Post causes current record pointer to change?


The other problems with TQuery and inserts is that TQuery is not deterministic.
That measn that it does not determine what goes in the result set and what does
not.  The effort is done on the server side.  After inserts and a post the
inserts record is removed from the local result set becasue the TQuery componetn
has no way of determining that it belongs in the result set.  You have to
requery the DB to have the server determine if it belongs or not.

One way around this is to work in cached update mode.  The insert will stay
local until you apply the changes to the DB side at which tiem it will resume
the normal behavior.  That will allow you to insert, edit then post all the
changes to the DB without the cursor changing between the ?Insert Post and your
edit.

Quote
Mark Huebner wrote:

> I tried changing the Query.Append to a Query.Insert and the current
> record pointer still changed on the Post.  Any other ideas?

> On Sat, 26 Feb 2000 13:01:31 -0500, "Jeff Overcash (TeamB)"
> <overc...@onramp.net> wrote:

> >Try not using Append with SQL backends.  Append expects that the record is going
> >at the end and Oracle will place the record where it wants it to go
> >irregaurdless if you are trying to put it to the back.  Just do an Insert and
> >see if that helps.

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Other Threads