-----BEGIN PGP SIGNED MESSAGE-----
Tom Lane wrote:
> Hm. Is that really the right behavior? Given that the function is
> defined to take a counted string rather than a null-terminated string,
> I'd sort of expect it to turn \0 into "\000" or some such. Of course,
> given that this could overflow the specified size of the return buffer,
> one might simply conclude that the defined API is broken ...
Igor Shevchenko replied:
> If the purpose of PQescapeString is to make a safe variant of a given string
> (NULL-terminated or counted), where safity means ability to simply add it to
> the query (which is char* and is passed directly to PQexec), then either
> length should return what strlen would return for the given string or \0
> should be escaped somehow.
Has we reached a consensus on this? I'd like to have DBD::Pg and PQescapeString
consistent. Right now, we (DBD::Pg) are leaning toward the "bail if we hit \0"
theory, but it would be nice to have something definitive in the API.
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200310030936
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
In response to
pgsql-interfaces by date
|Next:||From: Tom Lane||Date: 2003-10-03 15:31:02|
|Subject: Re: PQescapeString handling of \0 |
|Previous:||From: Carsten Klein||Date: 2003-10-01 22:57:37|
|Subject: Embedded SQL: Putting a guard around included stdio.h for convenience|