Placeholder Redux

Placeholder Redux

am 24.08.2002 01:07:17 von Scott Tadman

I've had quite a bit of hassle using placeholders recently due to the way
the DBD::mysql driver handles them. It turns out I'm not alone, as evidenced
by the following examples:

http://marc.theaimsgroup.com/?l=mysql&m=94863263002356&w=2
http://marc.theaimsgroup.com/?l=msql-mysql-modules&m=1006531 28007184&w=2

The specific problem is that if a placeholder is "primed" using an integer-
type value, and then later used with a string, the placeholder expansion
is broken, since the string seems to effect a kind of buffer-overrun.

I have distilled this down to a simple test case.

If quoting your "integers" is such a big deal, why isn't this covered in
the documentation? The way DBD::mysql fails is so obscure it must surely
be considered a bug and not a user error.

The second question is why the driver makes such wild assumptions, placing
the burden on the programmer to use the driver in such an odd way. I'm
wondering if it might just be better to "assume" a safe default, such
as changing line 158 of the most recent dbdimp.c to something like:

if (!ph->type) {
ph->type = SQL_VARCHAR;
}

Where now it is using SvNIOK to alternate between SQL_INTEGER and SQL_VARCHAR.
Super frustrating.


------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1896@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.