IBX for Lazaus follows the original Deplhi IBX approach of adopting PSQL syntax 
for named parameters. For example:Select * From EMPLOYEE where EMP_NO = 
:KEYVALUE;It also allows for parameter names  that are case sensitive and which 
contain special characters by enclosing the parameter name in double quotes 
e.g.Select * From EMPLOYEE where EMP_NO = :"Key Value";Named parameter handling 
takes place in the underlying Firebird Pascal API.Additionally, in IBX itself, 
the SQL update queries defined for a buffered dataset (TDataset descendents) 
allow parameter names to be preceded by "OLD_" or "NEW_". When a row in a 
buffered dataset is being edited, the original row values are saved and can be 
accessed using the "OLD_" prefix. The current values are returned by default or 
when "NEW_" is used as a prefix (effectively "NEW_" is not needed but included 
for completeness). e.g.UPDATE EMPLOYEE Set EMP_NO = :EMP_NO, FIRST_NAME = 
:FIRST_NAME where EMP_NO = :OLD_EMP_NO;The above updates the FIRST_NAME and the 
EMP_NO with any changes but always uses the old value of EMP_NO in order to 
update the correct row,If Firebird did support named parameters in a new 
version, I am not sure if this would be used by IBX. The code already works 
well and would have to be retained for the support of older versions of 
Firebird. The TDataset conventions would also have to continue to be 
supported.RegardsTony Whyman
-------- Original message --------From: Adriano dos Santos Fernandes 
<adrian...@gmail.com> Date: 18/08/2022  03:03  (GMT+00:00) To: For discussion 
among Firebird Developers <firebird-devel@lists.sourceforge.net> Subject: 
[Firebird-devel] Named parameters in client libraries Hi Mark, Jiri, all!How 
are client libraries (Jaybird, .NET Provider, Delphi ones)describing its named 
parameters to their users?I mean, given this SQL:select *  from rdb$database  
where :param = 1 or :param = '2'We have here single name used in context with 
multiple types.I suppose you transform this to:select *  from rdb$database  
where ? = 1 or ? = '2'Which will map to two Firebird parameters with different 
types.But for the user of the library, I suppose it's one parameter, 
correct?And what type (and the deduction rules) this parameter will be 
described as?AdrianoFirebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to