Solved

Weird things w/Packages and with do statements

Posted on 1998-06-05
4
248 Views
Last Modified: 2010-04-06
Okay the situation.
Delphi 3 C/S.  The program is compiled with packages(matter of fact with about 10 packages in total not including Borland's).  

It seems that under specific conditions, the IDE looses it's place when stepping through code.  This sometimes happens if you place a break point inside of a with do statement.

Example:
procedure InsertStoreInfo;
var
  inItem_id: integer;
begin
  with qryAccountInfo do
  begin
    qryStoreAccnts.First;  <<place break point here
    While not qryStoreAccnts.EOF do
    begin
      Insert;
      FieldByName('store').Value :=   qryStoreAccnts.FieldByName('location_id').Value;
      FieldByName('acct_id').Value := qryStoreAccnts.FieldByName('store_acct').Value;
      qryStoreAccnts.Next;
    end;
  end;
  FItemInsert := false;
end;

If you placed a break point at First, it would show EOF true.  Even though there was one record in the underlying table.

What was happening is that the code was actually getting to the insert, even though the breakpoint showed that it was stopped on First.  When insert was being called their was some code to stop newrecords(abort) which was causing our EOF to be true;

The solution was to yank the with do part of the code...The ide actually stopped on first...and showed EOF to false.  Stepping through showed the abort to be called...aha...problem solved.  

Boy I pulled my hair out until I figured it was bypassing my breakpoint...

Anyone else seen this behavior???Anyway to stop it and keep my with do's???(Yes I did a build all, and had new dpl's for the rest of the project)
0
Comment
Question by:rickpet
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350718
Hi

I have had this behaviour before.  In my case it went away after I did the following:
1)  View Breakpoints (on View menu) and remove ALL break points.
2)  Close Delphi (I rebooted my PC too, just for good measure :)
3)  Load Delphi & project, and Build All.

That fixed it for my specific problem, which was also a program with many packages (total build of 352000 lines).

Cheers,
JB
0
 
LVL 3

Author Comment

by:rickpet
ID: 1350719
JimBob...

seems that fixed the problem...Oh how I hate packages...

So...we will be very careful while using breakpoints.  Like deleting them between builds...So give us an answer and I'll grade you. =)-~

Thanks Rick

0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 50 total points
ID: 1350720
Hi Rick

Here is the answer you requested, but don't grade it until you're 100% happy that your problem is fixed.

Cheers,
JB
0
 
LVL 3

Author Comment

by:rickpet
ID: 1350721
Nope...pretty happy...went and recreated the problem...seems to have fixed it...probably somehow the IDE and the code are getting out of synch...Breakpoints and with statements just make the situation worse...

Thanks...tried everything but deleting the breakpoints...

Rick
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now