🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #817

UpdateRecordTypes Bug

#817
From: agus
Date: Thu, 26 Oct 2000 00:00
56 lines
2460 bytes
I am using C++ Builder ver 3, my database was Oracle 8.0.5.
I have DataModule names LedgerModule. Inside this module,
I have a table names Account.

I set CachedUpdates Property for Account table to true.

I create a user interface form to view/modify Account table.
I using Grid in that form. Then I wrote OnClose event
handler for that Form.

This event handler check wheather Account's table data
has been modified or deleted. If so, a messagebox appear
to remain User wheather she/he will save changes or just
discard them.

The problem is, that messagebox always appear even
there are no changes on data.

Here are the code for that event
void __fastcall TInput_Account::FormClose(TObject *Sender,
      TCloseAction &Action)
{
     int result;
     bool record_was_modified;

     record_was_modified = false;
     LedgerModule->Account->UpdateRecordTypes.Clear();
     LedgerModule->Account->UpdateRecordTypes << rtDeleted <<
rtModified;

     for (LedgerModule->Account->First();!LedgerModule->Account->Eof;
          LedgerModule->Account->Next());
           {
                record_was_modified = true;
           }
     LedgerModule->Account->UpdateRecordTypes << rtModified
                            << rtUnmodified << rtInserted;
     if (record_was_modified)
        {
           result = Application->MessageBox(
                    "Data has change ! Save changes ?",
                    "Confirmation",MB_YESNOCANCEL + MB_ICONQUESTION );

           if (result==IDYES) UpdateBtnClick(Sender);
           if (result==IDNO)  AbortBtnClick(Sender);
           if (result==IDCANCEL) return;

        }
}

It seem that UpdateRecordTypes doesn't work well.
Variable record_was_modified (inside for loop) always
assign to true although there were no changes in data.

Please tell me, this error cause from invalid code in my
program or there is a bug in C++ Builder.
Technical Details
Message-ID: <39F7FB8D.E4B133B2@bdg.centrin.net.id>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,1314478d7084fa47,start
X-Google-Attributes: gidfcd2b,public
From: agus <astopr@bdg.centrin.net.id>
Subject: UpdateRecordTypes Bug
Date: 2000/10/26
Message-ID: <39F7FB8D.E4B133B2@bdg.centrin.net.id>
X-Deja-AN: 686033743
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: 26 Oct 2000 02:28:08 -0800, 202.146.253.125
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.multi-tier