Subject Re: [ib-support] Delphi Delete Records
Author Martijn Tonies
> >> >you need stored procedures
> >> >i doubt it's too complicated for stored procedures
> >>
> >>trust me, it is... there are a lot of conditions, and the Delphi
> >>component written to check them is B I G.
> >
> >As a Delphi programmer, I can imagine the B L O A T you have had to put
> >into a data-tidying component to make it do a task which would be
> >economical and, by comparison, simple to do on the server in one or a
suite
> >of stored procedures.
>
> I know what you are saying, and I have often read postings from people
> who want to do 'x' because they have always done 'x'... but this is
> different - well, I think it is, anyway (:->
>
> >>The procedure is a 'file tidy' which deletes certain records under
> >>certain, changing, conditions.
> >
> >Sounds like a job for Mr Trigger.
>
> Mr Trigger wouldn't be very helpful, since what is changing is a set of
> management decisions, with no relevance to anything in any table. It is
> almost like saying, "I have decided never to deal with clients in
> Tunbridge Wells, or who have Scottish sounding names, or who are AOL
> users". There are currently about 60 of these rules, changing every two
> or three days, and it's very easy to add a line to the Delphi component
> "If email address ends in aol.com then test fails, get ready to delete",
> and very controllable.
>
> >>I don't have a problem with the time taken, it runs overnight, but I
> >>still can't figure out how to delete single records from the file which
> >>do not meet the criteria.
> >
> >You don't mean "file", do you?
>
> Well, er, no... (:->
>
> >DELETE FROM aTable
> >where not (set of conditions)
>
> In my case, DELETE FROM aTable where ID = :ThisRecordThatIJustDecidedIDi
> dntWant
>
> ...but I can't nail down the technique for that, and the Delphi books I
> read don't seem very helpful in the case of DELETE. Insert and Update
> are covered nicely within my Delphi TUpdateSQL component.

Pete, why don't you create a TIBSQL (or something) and simply issue
the DELETE FROM statement? And don't use a TUpdateSQL at all?


With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."