Subject | Re: [IBO] Programming question |
---|---|
Author | Helen Borrie |
Post date | 2001-12-09T00:50:13Z |
At 10:07 PM 08-12-01 +0100, you wrote:
Use it for any special updates, deletes or inserts that get parameters from another dataset.
As Nick pointed out, regular updates, inserts and deletes to datasets don't need any special treatment - the component will take care of them as long as you have set RequestLive true.
IBO's SQLWhereItems and SQLOrder properties (which must be applied in the OnPrepareSQL event) always cause an Unprepare and Prepare to be called automatically when they are encountered in the process of opening or executing a statement, if they alter the existing metadata "at the coal-face".
Unlike the native Delphi VCL and IBX, the IBO datasets don't need to go through every single step of the Unprepare/Prepare sequence each and every time. The IBO statement container is smart enough to work out what it has to do in each context.
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>I'm not working with a Grid or anything like that, So the Query isn't in sync with what I want to delete.If the DML is not related to a dataset, other than perhaps receiving a parameter as a result of user selecting a row, use a TIB_DSQL for your DML. Link the IB_Connection property of the ib_dsql to your ibodatabase. You must call Execute to run a ib_dsql.
>I'm talking about such kinds of queries. eg:
>
>I've to delete a certain record from the database in this way
>
>delete from holidays where holiday_date = ....
>
>In order to do this, I've to put that in a TIBOQuery.
Use it for any special updates, deletes or inserts that get parameters from another dataset.
As Nick pointed out, regular updates, inserts and deletes to datasets don't need any special treatment - the component will take care of them as long as you have set RequestLive true.
>Other question. What does 'prepare' exactly?I think so. <g> Prepare actually queries the database to get the metadata, when the statement changes the metadata in the statement's container. Obviously this is needed if you change the columns in a SELECT or the columns upon which the dataset is reduced (the WHERE or HAVING clause), grouped (GROUP BY) or sorted (ORDER BY). If the only thing that changes in the WHERE clause is the **value** of a parameter, you don't reprepare because this doesn't change the metadata of the dataset.
>
>I know prepare means to speed-optimize and put it ready for execution. And that you've to reprepare it when you change the sql-statement. But do you've to prepare a query again when you put another value to a parameter in the query? Basically you then change the query again (because at server side, the query is in fact a string) and does should be prepared again. But is my assumption correct?
IBO's SQLWhereItems and SQLOrder properties (which must be applied in the OnPrepareSQL event) always cause an Unprepare and Prepare to be called automatically when they are encountered in the process of opening or executing a statement, if they alter the existing metadata "at the coal-face".
Unlike the native Delphi VCL and IBX, the IBO datasets don't need to go through every single step of the Unprepare/Prepare sequence each and every time. The IBO statement container is smart enough to work out what it has to do in each context.
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________