I'm very new to Delphi and received the following piece of code (left out some irrelevant parts) for which I'm trying to understand what it does:
object SelectCosts: TIBQuery
SQL.Strings = (
'SELECT * FROM costs '
'WHERE code = :code')
ParamData = <
item
DataType = ftUnknown
Name = 'code'
ParamType = ptUnknown
end>
end
In another file, that query is used, but a parameter that is not defined in the query is added.
DM_HRV.SelectCosts.ParamByName('part').Value := 1;
Does this parameter 'part'
change anything about the selection made? In other words: is the SQL query automatically changed into the following?
'SELECT * FROM costs '
'WHERE code = :code'
'AND part = :part'
That means that the SQL statement might be changed at run-time. so when that query is used the SQL already contains
AND part = :part
.If the SQL statement does not contain this extra parameter
part
, an Exception will be raised when assigningParamByName('part').Value := 1
.I'm assuming you didn't confuse
SelectCosts
reference (which is inDM_HRV
and not other DM).