Closed misner closed 4 years ago
The named parameter order issue was supposedly resolved, so it could be the library that is messing things up. I'm removing the code that reorders the parameters and will test that.
@misner,
Give this a try with v1.0. The nested parsing should work now that we removed the need to "order" named parameters.
Thanks, Jeremy
Thanks, will try it!
I use a lot of data-api-client queries inside my lambdas (js/node) with no issue but I stumbled into a weird issue.
This code in my lambda is working:
But as soon as I change
customer_id = 2
tocustomer_id = :customer_id
, like this:... it starts to fail ! So the query below fail... this one little change makes everything crumble :(
The error I get on Cloudwatch is:
My intuition which might be wrong: because you say Named parameters MUST be sent in order (https://github.com/jeremydaly/data-api-client#named-parameters-must-be-sent-in-order), it means when it's a nested WHERE, it's not because it comes as the third parameter (if you read the code from up to bottom) that's it's actually the third that SQL "sees", so my order of parameters in the parameters block is wrong.
How can I make this work? In the "worst" case where dat-api-client does not work inside "nested" WHERE, then can I use the string literal
${ }
as it's a JavaScript file and it might be interpreted (and of course remove it from the parameters block) ?I tried and it seems replacing everywhere i have :named_parameters with literals
${ }
work. If the case I can use${ }
whenever in the sql query I used to have :named_parameter, what is the value-added of named parameters, I mean is there a case where I can't use${ }
and should only use your named parameters ?Thanks