[Home]

Summary:ASTERISK-09769: MS SQL 2005 escape character problem
Reporter:Antonis Psaras (apsaras)Labels:
Date Opened:2007-06-27 13:08:07Date Closed:2007-07-10 10:15:35
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20070627__bug10075.diff.txt
Description:I am using Asterisk 1.4.5 with Realtime, unixODBC, freeTDS and MS SQL 2005. I had some problems getting extensions to work from Database. After a trace on SQL queries I found the problem. When the extension query is executed is using \ as escape character at the exten column. Select * From extensions Where exten like '\_%' ....

SQL 2005 does not have a default escape character so you might do
... like '[_]%' ...
or
... like '\_%' ESCAPE '\'

Is that a freeTDS problem or Asterisk MS SQL implementation problem?
Comments:By: Russell Bryant (russell) 2007-06-27 13:29:41

Corydon, would you mind taking a look at this one?

By: Tilghman Lesher (tilghman) 2007-06-27 14:29:57

Okay, syntax appears to be a standard SQL extension, and it works with both mysql and postgres, so here's a prospective patch.

By: Tilghman Lesher (tilghman) 2007-07-06 00:31:53

apsaras:  I need you to test this patch, to ensure that it works for you.  Please report back on your testing results.

By: Antonis Psaras (apsaras) 2007-07-06 07:56:06

Yes it is works fine. Thank you.

By: Digium Subversion (svnbot) 2007-07-06 10:49:48

Repository: asterisk
Revision: 73684

------------------------------------------------------------------------
r73684 | russell | 2007-07-06 10:49:48 -0500 (Fri, 06 Jul 2007) | 8 lines

(closes issue ASTERISK-9769)
Reported by: apsaras
Patches submitted by: Corydon76
Tested by: apsaras

Fix a problem with MSSQL 2005 by explicitly stating that '' is being used as
an escape character.

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-07-06 10:56:12

Repository: asterisk
Revision: 73696

------------------------------------------------------------------------
r73696 | russell | 2007-07-06 10:56:12 -0500 (Fri, 06 Jul 2007) | 16 lines

Merged revisions 73684 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r73684 | russell | 2007-07-06 11:06:27 -0500 (Fri, 06 Jul 2007) | 8 lines

(closes issue ASTERISK-9769)
Reported by: apsaras
Patches submitted by: Corydon76
Tested by: apsaras

Fix a problem with MSSQL 2005 by explicitly stating that '' is being used as
an escape character.

........

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-07-06 10:58:01

Repository: asterisk
Revision: 73701

------------------------------------------------------------------------
r73701 | russell | 2007-07-06 10:58:00 -0500 (Fri, 06 Jul 2007) | 24 lines

Merged revisions 73696 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r73696 | russell | 2007-07-06 11:12:51 -0500 (Fri, 06 Jul 2007) | 16 lines

Merged revisions 73684 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r73684 | russell | 2007-07-06 11:06:27 -0500 (Fri, 06 Jul 2007) | 8 lines

(closes issue ASTERISK-9769)
Reported by: apsaras
Patches submitted by: Corydon76
Tested by: apsaras

Fix a problem with MSSQL 2005 by explicitly stating that '' is being used as
an escape character.

........

................

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-07-10 10:13:37

Repository: asterisk
Revision: 74313

------------------------------------------------------------------------
r74313 | russell | 2007-07-10 10:13:34 -0500 (Tue, 10 Jul 2007) | 3 lines

Only use ESCAPE when LIKE is used.  
(issue ASTERISK-9769, this part reported by jmls on IRC, patch by me)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-07-10 10:14:55

Repository: asterisk
Revision: 74314

------------------------------------------------------------------------
r74314 | russell | 2007-07-10 10:14:55 -0500 (Tue, 10 Jul 2007) | 11 lines

Merged revisions 74313 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74313 | russell | 2007-07-10 10:30:20 -0500 (Tue, 10 Jul 2007) | 3 lines

Only use ESCAPE when LIKE is used.  
(issue ASTERISK-9769, this part reported by jmls on IRC, patch by me)

........

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-07-10 10:15:35

Repository: asterisk
Revision: 74315

------------------------------------------------------------------------
r74315 | russell | 2007-07-10 10:15:35 -0500 (Tue, 10 Jul 2007) | 19 lines

Merged revisions 74314 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r74314 | russell | 2007-07-10 10:31:41 -0500 (Tue, 10 Jul 2007) | 11 lines

Merged revisions 74313 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74313 | russell | 2007-07-10 10:30:20 -0500 (Tue, 10 Jul 2007) | 3 lines

Only use ESCAPE when LIKE is used.  
(issue ASTERISK-9769, this part reported by jmls on IRC, patch by me)

........

................

------------------------------------------------------------------------