[
https://issues.apache.org/jira/browse/CASSANDRA-2623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030801#comment-13030801
]
rday edited comment on CASSANDRA-2623 at 5/9/11 4:48 PM:
---------------------------------------------------------
Just replacing the 2 quotes with one seems to work for the simple case in 7.5.
{code:title=CliUtils.java|borderStyle=solid}
public static String unescapeSQLString(String b)
{
if (b.charAt(0) == '\'' && b.charAt(b.length()-1) == '\'')
b = b.substring(1, b.length()-1);
b = b.replaceAll("''","'");
return StringEscapeUtils.unescapeJava(b);
}
{code}
was (Author: rday):
Just replacing the 2 quotes with one seems to work for the simple case in
7.5.
public static String unescapeSQLString(String b)
{
if (b.charAt(0) == '\'' && b.charAt(b.length()-1) == '\'')
b = b.substring(1, b.length()-1);
b = b.replaceAll("''","'");
return StringEscapeUtils.unescapeJava(b);
}
> CLI escaped single quote parsing gives errors
> ---------------------------------------------
>
> Key: CASSANDRA-2623
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2623
> Project: Cassandra
> Issue Type: Bug
> Components: Tools
> Environment: windows vista, linux
> Reporter: rday
> Assignee: Pavel Yaskevich
> Priority: Minor
> Labels: cli
> Fix For: 0.7.6, 0.8.1
>
>
> Escaping quotes in cli commands causes parsing errors.
> some examples::::
> No need to create columns etc, it doesn't get through parsing the expression::
> cassandra-cli
> 1.
> set column['KEY+vals'][VALUE] = 'VAL\'' ;
> Syntax error at position 41: mismatched character '<EOF>' expecting '''
> 2.
> set column['KEY+val\'s'][VALUE] = 'VAL' ;
> Syntax error at position 41: mismatched character '<EOF>' expecting '''
> 3.
> set column['KEY+vals\''][VALUE] = 'VAL\'' ;
> Syntax error at position 38: unexpected "\" for `set
> column['KEY+vals\''][VALUE] = 'VAL\'' ;`.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira