Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 17 total
Thread DBISAMQuery not updating
Tue, May 23 2006 6:50 PMPermanent Link

Kerry Neighbour
I have tried this with V4.24b1 and Delphi 7.

I have a DBISAMQuery on a form connected to a local database folder (ie,
I am not using the remote client/server).

I have SQL like "SELECT id,boxnumber,datestring FROM boxes"

I set the Query to RequestLive and ReadOnly=false

I then loop through the whole dataset and edit a field. ie

with DBISAMQuery do
begin
  open;
  first;
  while not EOF do
      begin
          edit;
          FieldByName("datestring").AsString := "some value";
          post;
          next;
      end;
  close;
end;

This does not work. Well, it looks like it does - but nothing gets saved
in the table. If I single step though this code, when I do the POST, I can
check the value of DBISAMQuery.FieldByName("datestring") and it is correct
(using the inbuilt Delphi watch function) - it displays the value that I
have set it to. Just as it should - it LOOKS like it is working.

I can loop this through the whole table, and every row gets set to the correct
value. I can check the IsModified flag - and it is being set and reset. Great.

The only problem is - nothing actually gets updated in the table. you can
look at the table after this loop has processed, and nothing has been updated.

I spent quite a bit of time on this - in the end I gave up and changed the
DBISAMQuery to a DBISAMTable, and it all worked perfectly. In this particular
situation, a table is fine - but in some situations (ie more advanced filtering),
a query is better, so I would like to workout why this problem occurrs.

At the very least - it would be nice to know that the updates never occurred
- instead of every indication saying that the updates were carried out.

This is some old code that has been working in the past - I only came across
this problem due to another issue that I was trying to fix

Is this a bug, or am I doing something wrong?



Kerry Neighbour

Tue, May 23 2006 8:09 PMPermanent Link

"Clive"
Check

DBISAMQuery.ResultIsLive

To confirm you are actually getting a live result set first. Check after
opening query.

Then check you dont have and OnBeforePost handling for this query that could
be cancelling the updates. Or any other query events that could be
interferring with your update.



"Kerry Neighbour" <kneighbour@securedoc.com.au> wrote in message
news:639022ca1ce2d8c84d25fc354d38@news.elevatesoft.com...
>I have tried this with V4.24b1 and Delphi 7.
>
> I have a DBISAMQuery on a form connected to a local database folder (ie, I
> am not using the remote client/server).
>
> I have SQL like "SELECT id,boxnumber,datestring FROM boxes"
>
> I set the Query to RequestLive and ReadOnly=false
>
> I then loop through the whole dataset and edit a field. ie
>
> with DBISAMQuery do
> begin
>   open;
>   first;
>   while not EOF do
>       begin
>           edit;
>           FieldByName("datestring").AsString := "some value";
>           post;
>           next;
>       end;
>   close;
> end;
>
> This does not work. Well, it looks like it does - but nothing gets saved
> in the table. If I single step though this code, when I do the POST, I can
> check the value of DBISAMQuery.FieldByName("datestring") and it is correct
> (using the inbuilt Delphi watch function) - it displays the value that I
> have set it to. Just as it should - it LOOKS like it is working.
>
> I can loop this through the whole table, and every row gets set to the
> correct value. I can check the IsModified flag - and it is being set and
> reset. Great.
>
> The only problem is - nothing actually gets updated in the table. you can
> look at the table after this loop has processed, and nothing has been
> updated.
>
> I spent quite a bit of time on this - in the end I gave up and changed the
> DBISAMQuery to a DBISAMTable, and it all worked perfectly. In this
> particular situation, a table is fine - but in some situations (ie more
> advanced filtering), a query is better, so I would like to workout why
> this problem occurrs.
>
> At the very least - it would be nice to know that the updates never
> occurred - instead of every indication saying that the updates were
> carried out.
>
> This is some old code that has been working in the past - I only came
> across this problem due to another issue that I was trying to fix
>
> Is this a bug, or am I doing something wrong?
>
>
>
> Kerry Neighbour
>
>

Tue, May 23 2006 11:25 PMPermanent Link

Kerry Neighbour
> DBISAMQuery.ResultIsLive
>

I tried this - but it says the linker has removed this function - so I canot
see what the result is.

> To confirm you are actually getting a live result set first. Check
> after opening query.
>
> Then check you dont have and OnBeforePost handling for this query that
> could be cancelling the updates. Or any other query events that could
> be interferring with your update.
>

No - no events of any sort.

Tue, May 23 2006 11:59 PMPermanent Link

Jeff Cook
Kerry Neighbour <kneighbour@securedoc.com.au> wrote on Wed, 24 May 2006 03:23:17 +0000 (UTC)

>
>> DBISAMQuery.ResultIsLive
>>
>
>I tried this - but it says the linker has removed this function - so I canot
>see what the result is.
>
Kerry

That'll be because you aren't doing anything with the result.  Just do something like this:-

if DBISAMQuery.ResultIsLive then showmessage('Alive, Alive, Oh1')
else showmessage('Eeeergh! I've been deaded!);

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Wed, May 24 2006 2:15 AMPermanent Link

"Iztok Lajovic"
Kerry,

when I encounter such problem I try to do the same query with DBSYS to see
if it produces eventually canned result set. That normally happens when I
overlook something. This method also helps me to optimise the query.

Iztok Lajovic


"Kerry Neighbour" <kneighbour@securedoc.com.au> je napisal v sporocilo
news:639022ca1ce2d8c84d25fc354d38@news.elevatesoft.com ...
>I have tried this with V4.24b1 and Delphi 7.
>
> I have a DBISAMQuery on a form connected to a local database folder (ie, I
> am not using the remote client/server).
>
> I have SQL like "SELECT id,boxnumber,datestring FROM boxes"
>
> I set the Query to RequestLive and ReadOnly=false
>
> I then loop through the whole dataset and edit a field. ie
>
> with DBISAMQuery do
> begin
>   open;
>   first;
>   while not EOF do
>       begin
>           edit;
>           FieldByName("datestring").AsString := "some value";
>           post;
>           next;
>       end;
>   close;
> end;
>
> This does not work. Well, it looks like it does - but nothing gets saved
> in the table. If I single step though this code, when I do the POST, I can
> check the value of DBISAMQuery.FieldByName("datestring") and it is correct
> (using the inbuilt Delphi watch function) - it displays the value that I
> have set it to. Just as it should - it LOOKS like it is working.
>
> I can loop this through the whole table, and every row gets set to the
> correct value. I can check the IsModified flag - and it is being set and
> reset. Great.
>
> The only problem is - nothing actually gets updated in the table. you can
> look at the table after this loop has processed, and nothing has been
> updated.
>
> I spent quite a bit of time on this - in the end I gave up and changed the
> DBISAMQuery to a DBISAMTable, and it all worked perfectly. In this
> particular situation, a table is fine - but in some situations (ie more
> advanced filtering), a query is better, so I would like to workout why
> this problem occurrs.
>
> At the very least - it would be nice to know that the updates never
> occurred - instead of every indication saying that the updates were
> carried out.
>
> This is some old code that has been working in the past - I only came
> across this problem due to another issue that I was trying to fix
>
> Is this a bug, or am I doing something wrong?
>
>
>
> Kerry Neighbour
>
>

Wed, May 24 2006 5:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kerry,

<< I have SQL like "SELECT id,boxnumber,datestring FROM boxes"

I set the Query to RequestLive and ReadOnly=false >>

Could you please send me an example of this, along with the table ?
Isolating things like this into a separate application helps find the source
of the problem.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, May 25 2006 6:51 PMPermanent Link

Kerry Neighbour
> << I have SQL like "SELECT id,boxnumber,datestring FROM boxes"
>
> I set the Query to RequestLive and ReadOnly=false >>
>
> Could you please send me an example of this, along with the table ?
> Isolating things like this into a separate application helps find the
> source of the problem.

I actually made up a test project for this quite common problem - and I stumbled
upon the cause.

My query actually was

"SELECT id,boxnumber,datestring FROM boxes ORDER BY boxnumber"

This query will NOT return a live database. I have no idea why not - as far
as I can see, it should. To fix the problem, you have to remove the ORDER
BY....ie this query works....

"SELECT id,boxnumber,datestring FROM boxes"

As far as I can see, this is a bug. If not (ie, there is some good reason
why it should not work), then fine. If you still want me to send you the
test project, I can still do so.


I am using DBISAM 4.24b1, with Delphi7. I know this problem was in DBISAM
4.22, and as far as I know, it has been there for some time as I constantly
battle with this problem. At least I now know what is causing it.

Thu, May 25 2006 7:06 PMPermanent Link

"Robert"

"Kerry Neighbour" <kneighbour@securedoc.com.au> wrote in message
news:639022ca1d9448c84eb8730c7560@news.elevatesoft.com...
>
> I actually made up a test project for this quite common problem - and I
> stumbled upon the cause.
>
> My query actually was
>
> "SELECT id,boxnumber,datestring FROM boxes ORDER BY boxnumber"
>
> This query will NOT return a live database. I have no idea why not - as
> far as I can see, it should. To fix the problem, you have to remove the
> ORDER BY....ie this query works....
>
> "SELECT id,boxnumber,datestring FROM boxes"
>
> As far as I can see, this is a bug. If not (ie, there is some good reason
> why it should not work), then fine. If you still want me to send you the
> test project, I can still do so.
>

The ORDER BY has to correspond exactly to an index for it to be a live
query. IOW, a live query is just like a tTable.

Robert


Thu, May 25 2006 7:13 PMPermanent Link

"Don Patrick"
The Order By field should be indexed to get a live result.

"Kerry Neighbour" <kneighbour@securedoc.com.au> wrote in message
news:639022ca1d9448c84eb8730c7560@news.elevatesoft.com...
> > << I have SQL like "SELECT id,boxnumber,datestring FROM boxes"
> >
> > I set the Query to RequestLive and ReadOnly=false >>
> >
> > Could you please send me an example of this, along with the table ?
> > Isolating things like this into a separate application helps find the
> > source of the problem.
>
> I actually made up a test project for this quite common problem - and I
stumbled
> upon the cause.
>
> My query actually was
>
>  "SELECT id,boxnumber,datestring FROM boxes ORDER BY boxnumber"
>
> This query will NOT return a live database. I have no idea why not - as
far
> as I can see, it should. To fix the problem, you have to remove the ORDER
> BY....ie this query works....
>
>  "SELECT id,boxnumber,datestring FROM boxes"
>
> As far as I can see, this is a bug. If not (ie, there is some good reason
> why it should not work), then fine. If you still want me to send you the
> test project, I can still do so.
>
>
> I am using DBISAM 4.24b1, with Delphi7. I know this problem was in DBISAM
> 4.22, and as far as I know, it has been there for some time as I
constantly
> battle with this problem. At least I now know what is causing it.
>
>

Thu, May 25 2006 7:19 PMPermanent Link

"Clive"
Wish you had given your "Actual" query first time around, then we would have
said very quickly that you probably dont have the correct index on
BoxNumber,

"Kerry Neighbour" <kneighbour@securedoc.com.au> wrote in message
news:639022ca1d9448c84eb8730c7560@news.elevatesoft.com...
>> << I have SQL like "SELECT id,boxnumber,datestring FROM boxes"
>>
>> I set the Query to RequestLive and ReadOnly=false >>
>>
>> Could you please send me an example of this, along with the table ?
>> Isolating things like this into a separate application helps find the
>> source of the problem.
>
> I actually made up a test project for this quite common problem - and I
> stumbled upon the cause.
>
> My query actually was
>
> "SELECT id,boxnumber,datestring FROM boxes ORDER BY boxnumber"
>
> This query will NOT return a live database. I have no idea why not - as
> far as I can see, it should. To fix the problem, you have to remove the
> ORDER BY....ie this query works....
>
> "SELECT id,boxnumber,datestring FROM boxes"
>
> As far as I can see, this is a bug. If not (ie, there is some good reason
> why it should not work), then fine. If you still want me to send you the
> test project, I can still do so.
>
>
> I am using DBISAM 4.24b1, with Delphi7. I know this problem was in DBISAM
> 4.22, and as far as I know, it has been there for some time as I
> constantly battle with this problem. At least I now know what is causing
> it.
>
>

Page 1 of 2Next Page »
Jump to Page:  1 2
Image