Solved

Weird things w/Packages and with do statements

Posted on 1998-06-05
4
252 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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