According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this.
Stas Boukarev stassats@gmail.com writes:
According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this.
Well, that was too soon, I forgot to attach the patch itself:
Stas Boukarev stassats@gmail.com writes:
Stas Boukarev stassats@gmail.com writes:
According to http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres sends them as {val1 ...}, the attached patch corrects this.
Aw, now I hit C-x C-w in the wrong buffer, that's what you get for being in a hurry. Sorry for the noise, here's the patch for real.
Hi Stas,
What happens when, with your patch, you try to pass an array as a query parameter? ($1, etc) I suspect the correct thing to do would be to return T as a second value from to-sql-string (which indicates that the string should be escaped when put into a query), rather than putting quotes into the returned string. Also, do you know what the correct syntax is when the array contains a string containing a single quote? I suspect it should be escaped, which will also be handled by returning a second t value. If you could test this for me, I'd be thankful.
Cheers, Marijn
Marijn Haverbeke marijnh@gmail.com writes:
Hi Stas,
What happens when, with your patch, you try to pass an array as a query parameter? ($1, etc) I suspect the correct thing to do would be to return T as a second value from to-sql-string (which indicates that the string should be escaped when put into a query), rather than putting quotes into the returned string. Also, do you know what the correct syntax is when the array contains a string containing a single quote? I suspect it should be escaped, which will also be handled by returning a second t value. If you could test this for me, I'd be thankful.
Indeed, returning T works in all cases you described. I've attached a corrected patch.
Thanks! Pushed to the repository.
Best, Marijn
postmodern-devel@common-lisp.net