On 19/08/2022 10:55, Adriano dos Santos Fernandes wrote:
On 19/08/2022 06:06, Tony Whyman wrote:
On 19/08/2022 00:42, Adriano dos Santos Fernandes wrote:
On 18/08/2022 18:53, Tony Whyman wrote:
IBX for Lazaus follows the original Deplhi IBX approach of adopting PSQL
syntax for named parameters.
Can a name be used more than once, and if yes, how is its type deduction?
Adriano
Uniqueness of parameters names is not required. If you have two or
parameters with the same name in a given SQL Statement then both get set
at the same time and to the same value.
Type conversions are an issue for Firebird rather than IBX and are
handled identically to positional parameters.
Can't the user's library inspect parameters and its type?
If yes, how would it be returned if a parameter name is used more than
once with different Firebird types deduced in the different
question-marks generated?
The user can always check the current SQL Type of a parameter and use
the setter they believe is most appropriate. If they insist on giving
the same parameter name to two or more different parameters with
differing SQL types - then that's their problem. The ByName method only
ever returns the first parameter with a given name in position order. If
the user calls its setter then the same value is given to all parameters
with the same name. If there are no type compatibility problems then it
works. If there are type compatibility issues then an exception occurs
when they execute the query. The correct solution is to use different
parameters names and set each parameter appropriately.
Adriano
Firebird-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