[Asterisk-bugs] [Asterisk 0010205]: Results containing spaces from FETCH cause ast_yyerror()

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jul 16 16:49:53 CDT 2007


The following issue has been CLOSED 
====================================================================== 
http://bugs.digium.com/view.php?id=10205 
====================================================================== 
Reported By:                jamesb63
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   10205
Category:                   Addons/app_addon_sql_mysql
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 75108M 
Disclaimer on File?:        No 
Request Review:              
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             07-15-2007 09:54 CDT
Last Modified:              07-16-2007 16:49 CDT
====================================================================== 
Summary:                    Results containing spaces from FETCH cause
ast_yyerror()
Description: 
When executing a query and getting its result, a field in a mysql table
containing a space causes the following error:

[Jul 15 16:06:13] WARNING[30551]: ast_expr2.fl:398 ast_yyerror:
ast_yyerror():  syntax error: syntax error, unexpected '<token>', expecting
$end; Input:
 James Mobile
       ^

With the ^ under the M

The query is simply:

select cidname from caller_id where cidnum = '${CALLERID(num)}';

If I remoe the space in the table and replace with _ (underscore), the
problem goes away.

This may not be the right category to post the bug but it's a result of
using the MYSQL() command from the addons package that I found the problem.
====================================================================== 

---------------------------------------------------------------------- 
 murf - 07-16-07 16:49  
---------------------------------------------------------------------- 
I've got some documentation on the "space problem" that results from
variable expansion; see the doc/channelvariables.txt file, the section 
"SPACES INSIDE VARIABLE VALUES"...

You can force the expression parser to accept a space-containing value as
a single token by wrapping it in double quotes.

Also, saying something like:

CALLERID(name) = ${CID_NAME};

is dangerous if CID_NAME can contain spaces, because the right hand side
of the
assignment is enclosed with $[..] when it's compiled. You can prevent the

evaluation of the right hand side by using the Set application:

Set(CALLERID(name)=${CID_NAME});

Reopen this bug if you feel that I am grossly in error, didn't understand
your problem, or you perceive that I am in la-la land. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-16-07 16:49  murf           Note Added: 0067413                          
======================================================================




More information about the asterisk-bugs mailing list