Solved

Weird things w/Packages and with do statements

Posted on 1998-06-05
4
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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