Closed atari83 closed 1 year ago
Please use soci::use()
instead of string concatenation for your query parameters. Doing the latter is a really bad idea for too many reasons (search for "SQL injection" for a start) and also misinterprets :foo
as parameter name.
Thank youuuu !! You're absolutely life-saver !
Sorry for my mistake, totally forgot about soci::use
^_^!
Hello ! I'm using soci 4.0.1 with Postgresql 14.0 on my FreeBSD 13.0 (amd64) machine. All is good, except I noticed when I batch/bulk insert some json (as text) into my table, the inserted data is somehow modified ! Honestly, I'm not sure it is related to soci, but I'm totally confused and will be appreciated for any help.
So, for insert I use this snippet code:
The
var
is a string variable that contains multiple values that need to be inserted. There is no errors and records are getting inserted into the table, however If my Original data is:{"key":"value"}, {"key2":"value2"}
Then when i query from database, I'll have:{"key"$1"value"}, {"key2"$2"value2"}
The colon signs will turn to dollar sign with follow up numbers.
It's worth to mention I don't encounter this issue, when i use postgresql console with same sql command.