Skip Menu |

This queue is for tickets about the SQL-Abstract CPAN distribution.

Report information
The Basics
Id: 65556
Status: resolved
Priority: 0/
Queue: SQL-Abstract

People
Owner: Nobody in particular
Requestors: CJK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Missing brackets in pod
The following is an excerpt from the documenation: To get an OR instead, you can combine it with the arrayref idea: my %where => ( user => 'nwiger', priority => [ {'=', 2}, {'!=', 1} ] ); Which would generate: $stmt = "WHERE user = ? AND priority = ? OR priority != ?"; @bind = ('nwiger', '2', '1'); I believe that the generated SQL should instead read: $stmt = "WHERE user = ? AND (priority = ? OR priority != ?)"; This would certainly be what I'd intuitively expect to be generated, and seems to correspond with current module behaviour.
Doc patch added
Subject: brackets.patch
commit 6c9cf2c7a90e0932ad046a3914650b078e002487 Author: Clinton Gormley <clinton@iannounce.co.uk> Date: Fri Apr 1 10:58:15 2011 +0200 POD correction to "priority => [ {'=', 2}, {'!=', 1} ]" diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 2041fa6..acad0d6 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -2080,7 +2080,7 @@ To get an OR instead, you can combine it with the arrayref idea: Which would generate: - $stmt = "WHERE user = ? AND priority = ? OR priority != ?"; + $stmt = "WHERE user = ? AND ( priority = ? OR priority != ? )"; @bind = ('nwiger', '2', '1'); If you want to include literal SQL (with or without bind values), just use a
patched, http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/SQL- Abstract.git;a=commit;h=1a6f2a0307e8b76ff774d183c676ff56e04121d6 Thanks!