Skip Menu |
 

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

Report information
The Basics
Id: 14498
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: zgia [...] billwang.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.0002_1
Fixed in: (no value)



Subject: I cannot use "union" in my query after I installed DBD-mysql-3.0002_1.tar.gz and DBI-1.48.tar.gz
Download (untitled) / with headers
text/plain 1.6k
You have an error in your SQL syntax near '( SELECT cms_articles.*, cms_categories.title, cms_categories.flag, cms_categori' at line 2 ================ QUERY: ================ my $query = " ( SELECT cms_articles.*, cms_categories.title, cms_categories.flag, cms_categories.titleShowMode, cms_categories.titleShowChars FROM cms_articles LEFT JOIN cms_categories ON cms_categories.id = cms_articles.categoryId WHERE cms_articles.approve != 0 AND cms_articles.del = 0 AND cms_categories.flag IN ('1','101','102','103','104','106') ORDER BY postTime DESC LIMIT 0,10 ) union (SELECT cms_articles.*, cms_categories.title, cms_categories.flag, cms_categories.titleShowMode, cms_categories.titleShowChars FROM cms_articles LEFT JOIN cms_categories ON cms_categories.id = cms_articles.categoryId WHERE cms_articles.approve != 0 AND cms_articles.del = 0 AND cms_categories.flag='105' ORDER BY postTime DESC LIMIT 0,10) union (SELECT cms_articles.*, cms_categories.title, cms_categories.flag, cms_categories.titleShowMode, cms_categories.titleShowChars FROM cms_articles LEFT JOIN cms_categories ON cms_categories.id = cms_articles.categoryId WHERE cms_articles.approve != 0 AND cms_articles.del = 0 AND cms_categories.flag='107' ORDER BY postTime DESC LIMIT 0,2) union (SELECT cms_articles.*, cms_categories.title, cms_categories.flag, cms_categories.titleShowMode, cms_categories.titleShowChars FROM cms_articles LEFT JOIN cms_categories ON cms_categories.id = cms_articles.categoryId WHERE cms_articles.approve != 0 AND cms_articles.del = 0 AND cms_categories.flag IN (2,201,202) ORDER BY postTime DESC LIMIT 0,10) "; my $sth = query($query); my $informations = $sth->fetchall_arrayref({}); $sth->finish;
Download (untitled) / with headers
text/plain 528b
Fixed in latest version (3.0007) my $dbh= DBI->connect("DBI:mysql:test:localhost;mysql_server_prepare=1", "root", "", { PrintError => 0}) || die $DBI::errstr; my $sth= $dbh->prepare("(SELECT 1,2,3) UNION (SELECT 1,2,3)"); print "error: " . $DBI::errstr . "\n" if $DBI::errstr; $sth->execute(); my $ar_ref= $sth->fetchall_arrayref(); print Dumper $ar_ref; radha:~/perl patg$ ./bug14498.pl $VAR1 = [ [ '1', '2', '3' ] ];


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.