?
Solved

Weird things w/Packages and with do statements

Posted on 1998-06-05
4
Medium Priority
?
256 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

840 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