EditSQL property |
Applies to
TIB_Dataset
Declaration
Property EditSQL : TIB_StringList;
Description
This property is used to supply a custom SQL statement that will take care
of editing the current row of the dataset. It uses the same syntax as the
VCL's TUpdateSQL.ModifySQL property does.
For example:
UPDATE MYTABLE SET
MYCOL1 = :MYCOL1
MYCOL2 = :MYCOL2
WHERE MYKEY = :OLD_MYKEY
By prefacing the column name with OLD_ on the parameter it will be sure to use
the old value so that it will for sure align with the state of the record on
the server.
It is NOT necessary to use this component if you have properly assigned KeyLinks
to the dataset. IBO automatically generates the standard statements to perform
updates.
I have found this property useful to perform non-standard actions when editing
a record in a dataset. One case could be where the dataset is actually
derived from a select stored procedure. You may also have declared another
stored procedure to perform the edit.
For example:
EXECUTE PROCEDURE MYEDITPROC ( :MYCOL1, :MYCOL2, :OLD_MYKEY )
This will pass in the necessary information to the stored procedure and then as
long as you did your job right it will take care of whatever database actions
are required to effectively update that record.
Keep in mind that when using a stored procedure you do not have the automatic
protection of checking the RowsAffected property performed for you. It will be
a very good idea to thoroughally test such practices.