[Users] The lcr module has incorrect syntax for the current mysql release

Brandon Price brandon at dacrib.net
Thu Aug 3 16:32:14 CEST 2006


Of coarse I found this out after upgrading my test box from mysql  
5.0.19 to 5.0.22. The lcr module runs the following query...

SELECT gw.ip_addr, gw.port, gw.uri_scheme, gw.transport, gw.strip,  
gw.prefix FROM gw, lcr WHERE ''<sip:12345678910 at eastern.mynoc.net>''  
LIKE lcr.from_uri AND '15184782222' LIKE CONCAT(lcr.prefix, '%') AND  
lcr.grp_id = gw.grp_id ORDER BY CHAR_LENGTH(lcr.prefix), lcr.priority  
DESC, RAND()

which returns

ERROR 1064 (42000): You have an error in your SQL syntax; check the  
manual that corresponds to your MySQL server version for the right  
syntax to use near ':12345678910 at eastern.mynoc.net>'' LIKE  
lcr.from_uri AND '15184782222' LIKE CONCA' at line 1

the correct query would be ...

  SELECT gw.ip_addr, gw.port, gw.uri_scheme, gw.transport, gw.strip,  
gw.prefix FROM gw, lcr WHERE '<sip:12345678910 at eastern.mynoc.net>'  
LIKE lcr.from_uri AND '15184782222' LIKE CONCAT(lcr.prefix, '%') AND  
lcr.grp_id = gw.grp_id ORDER BY CHAR_LENGTH(lcr.prefix), lcr.priority  
DESC, RAND();

Notice that I removed the double single quotes around <sip: 
12345678910 at eastern.mynoc.net> which is the from uri. This appears to  
be broken in current cvs as well.




More information about the Users mailing list