[asterisk-bugs] [Asterisk 0011353]: Problem with Like query on MS SQL

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jan 21 12:19:10 CST 2008


The following issue has been CLOSED 
====================================================================== 
http://bugs.digium.com/view.php?id=11353 
====================================================================== 
Reported By:                apsaras
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   11353
Category:                   PBX/pbx_realtime
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.6.0-beta1 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             11-22-2007 16:37 CST
Last Modified:              01-21-2008 12:19 CST
====================================================================== 
Summary:                    Problem with Like query on MS SQL
Description: 
The problem is the MSSQL server does not support back slash "\" as escape
character on select queries hence when you execute 

SELECT * FROM extensions WHERE exten LIKE '\_%' AND context = 'default'
AND priority = '1' ORDER BY exten

is not working. The correct and most commonly used syntax is

SELECT * FROM extensions WHERE exten LIKE '[_]%' AND context = 'default'
AND priority = '1' ORDER BY exten

As far as I concern this is compatible with mySQL and PostgreSQL.

The solution I propose is to change the line 

cfg = ast_load_realtime_multientry(table, "exten LIKE", "\\_%", "context",
context, "priority", pri, NULL);

at pbx_realtime.c to 

cfg = ast_load_realtime_multientry(table, "exten LIKE", "[_]%", "context",
context, "priority", pri, NULL);
====================================================================== 

---------------------------------------------------------------------- 
 Corydon76 - 01-21-08 12:19  
---------------------------------------------------------------------- 
Reopen if you're still having problems. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-21-08 12:19  Corydon76      Note Added: 0080961                          
01-21-08 12:19  Corydon76      Assigned To               => Corydon76       
01-21-08 12:19  Corydon76      Status                   feedback => closed  
01-21-08 12:19  Corydon76      Resolution               reopened => fixed   
======================================================================




More information about the asterisk-bugs mailing list