v.0.9.4
Added support for stripped variable values: a variable name now can be appended with symbol ^
to indicate that if it is text-like (text or Date), its value is to be injected as is, without being wrapped in single quotes:
$1^, $2^, etc...
or ${varName^}
This is to allow for special-case variable formatting, like in the following examples:
// injecting "John" name without quotes:
query("...WHERE name LIKE '%$1^%'", "John");
// injecting value of property 'name' without quotes:
query("...WHERE name LIKE '%${name^}%'", {name: "John"});
// injecting a CSV-formatted string without quotes:
query("...WHERE id IN($1^)", pgp.as.csv([1,2,3,4]));
Methods as.text(value, strip)
and as.date(value, strip)
have received new parameter-flag strip
as they are the ones handling the formatting.
I also started working on the Learn by Example tutorial, to help first time users.
Other changes include:
- Improved tests and test instructions;
- New tests were added to cover stripped variable functionality;
- Documentation updates.