Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 57257
Status: rejected
Priority: 0/
Queue: DBD-mysql

People
Owner: CAPTTOFU [...] cpan.org
Requestors: UNERA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 4.014
Fixed in: (no value)



for example we have a code: $dbh->selectall_arrayref(q{ SELECT * FROM table WHERE a > ? AND b > ? }, undef, 1, 2); and we want exclude a part of WHERE statement: $dbh->selectall_arrayref(q{ SELECT * FROM table WHERE a > ? /* AND b > ? */ }, undef, 1, 2); Previous versions of DBD::mysql allowed this variant, new version will throw exception because second '?' isn't processed. I looked through a few big project and found a lot of places such this example. I think that it was a bad idea to exclude comments from processing. please, return back
Thank you for reporting this! I'll fix it. On Thu May 06 07:28:54 2010, UNERA wrote: Show quoted text
> for example we have a code: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > AND b > ? > }, undef, 1, 2); > > and we want exclude a part of WHERE statement: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > /* AND b > ? */ > }, undef, 1, 2); > > Previous versions of DBD::mysql allowed this variant, new version will > throw exception because second '?' isn't processed. > > I looked through a few big project and found a lot of places such this > example. > I think that it was a bad idea to exclude comments from processing. > > please, return back
Hi, Actually, looking at this, you're accustomed to broken behavior. I had modified the driver to work exactly how server-prepared statements work, which means that placeholders that are in an actual statement will be bound, but if the placeholders are in a comment as you have shown, they will not. I can consider adding a flag to the driver for the old, incorrect behavior for you to use. I would suggest changing your application code to doing the correct thing, otherwise you could run into problems if you ever end up using server prepared statements or another database. On Thu May 06 07:28:54 2010, UNERA wrote: Show quoted text
> for example we have a code: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > AND b > ? > }, undef, 1, 2); > > and we want exclude a part of WHERE statement: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > /* AND b > ? */ > }, undef, 1, 2); > > Previous versions of DBD::mysql allowed this variant, new version will > throw exception because second '?' isn't processed. > > I looked through a few big project and found a lot of places such this > example. > I think that it was a bad idea to exclude comments from processing. > > please, return back
On Thu May 06 07:28:54 2010, UNERA wrote: Show quoted text
> for example we have a code: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > AND b > ? > }, undef, 1, 2); > > and we want exclude a part of WHERE statement: > > $dbh->selectall_arrayref(q{ > SELECT > * > FROM > table > WHERE > a > ? > /* AND b > ? */ > }, undef, 1, 2); > > Previous versions of DBD::mysql allowed this variant, new version will > throw exception because second '?' isn't processed. > > I looked through a few big project and found a lot of places such this > example. > I think that it was a bad idea to exclude comments from processing. > > please, return back