Subject [IBO] Re: Entering Litterals, Expressions directly into TIBOQuery Update SQL
Author Tony Masefield
Thanks Helen,

As you put it it's a snap! Worked straight-off. Shouldn't have spent
so much time messing with IBX and MDO before opting for IBO which
has 'clouded' my vision somewhat (expecting them to be similar in
function).
Have to go back through the IBO manual again and 'relearn' the
concepts/features. Certainly much 'richer' than I expected.

Rgds,

> Not in the least - I totally agree with you. Tony is trying to
bend
> and stretch his code to make IBO do what it does automatically.
>
> You don't need the TIBOUpdateSQL *at all* - it's only there for
> compatibility when people are converting an old BDE
> application. TIBOQuery has the UpdateSQL properties embedded
> (EditSQL, InsertSQL and DeleteSQL). What's more, you don't have
to
> set them yourself unless you've got datasets that have to be
update
> with specialised statements such as EXECUTE PROCEDURE calls.
>
> For your master-detail setup, do the following basics:
>
> 1. Set up the master and its datasource first, e.g. qMaster and
> dsMaster, with SQL that is typically
>
> select mstrpkfield, fieldx, fieldy from mymaster
> where <some parameterised conditions)
>
> Set its KeyLinks property to mstrpkfield and set RequestLive true.
>
> If you are generating primary keys then set GeneratorLinks as:
> pkfield=mypkgeneratorname
>
> 2. Then set up the detail, e.g. QDetail and its datasource
> dsDetail. The SQL will be in one of two forms:
>
> a) if the fieldnames of the detail's foreign key and the master's
> primary key are the same then your query will be:
>
> select detlpkfield, mstrpkfield, fieldwhatever, .... from mydetail
>
> b) if the foreign key of the detail set and the PK of the master
set
> don't have matching names then the detail's SQL will be
>
> select detlpkfield, mstr_gulp_pkfield, fieldwhatever, ....from
mydetail
> where mstr_gulp_pkfield = :mstr_gulp_pkfield
>
> Set the Keylinks to detlpkfield and set RequestLive true.
> Set the Datasource property to dsMaster.
>
> If you are generating primary keys then set GeneratorLinks as:
> detlpkfield=mydetlpkgeneratorname
>
>
> In both cases, by setting correct Keylinks and setting RequestLive
> true, you are telling IBO to generate the three UpdateSQL
statements
> automatically.
>
> If the detail's FK name and the master's PK name are same
(situation
> a) above) then you are done. Your master-detail interface
will "just work".
> If the names are different then you have one more thing to do. Go
to
> the AfterScroll event of the master set and add the following code:
>
> QDetail.ParamByName('mstr_gulp_pkfield').AsInteger :=
> Dataset.FieldByName('mstrpkfield').AsInteger;
>
> And now you are ready to roll.
>
> Helen
>