Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholders which appear after a LIMIT should not be quoted (DBD::mysql) #1

Merged
2 commits merged into from Feb 24, 2011

Conversation

yibe
Copy link
Contributor

@yibe yibe commented Feb 2, 2011

use strict;
use warnings;
use DBI;
use DBIx::QueryLog ();
my $dbh = DBI->connect('dbi:mysql:test', '', '');
DBIx::QueryLog->begin;
$dbh->do("SELECT * FROM tbl WHERE foo = ? LIMIT ? OFFSET ?", undef, 'bar', 10, 20);

When you run this code, the DBI with DBD::mysql actually interprets the statement as SELECT * FROM tbl WHERE foo = 'bar' LIMIT 10 OFFSET 20 and it is executed successfully, but you see the output below:

[Wed Feb  2 18:49:09 2011] [main] [0.000161] SELECT * FROM tbl WHERE foo = 'bar' LIMIT '10' OFFSET '20' at - line 7

This is syntactically incorrect and therefore inconvenient to use for debugging.
I have just made a quick fix for this. Hope this helps :)

ref.
https://github.com/CaptTofu/DBD-mysql/blob/master/dbdimp.c#L594

http://blog.nekokak.org/show?guid=bCdwOkUE4BGvTPMNMSAp_g

@xaicron
Copy link
Owner

xaicron commented Feb 24, 2011

Oh, Cool!!
thanks merged.
I'm sorry slow response ... :-(

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants