[jira] [Updated] (CASSANDRA-17238) Constants$Literal.getText does not escape ' chars

2022-01-06 Thread Sina Siadat (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sina Siadat updated CASSANDRA-17238:

Description: 
The [current 
implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
 is only adding single quotes around the text:
{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", text) : text;
}
{code}
So, getText for this string:
{code:java}
'this is a ''quoted'' word'
{code}
would return
{code:java}
'this is a 'quoted' word'
{code}
Maybe something like this would fix it, if necessary:
{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", 
StringUtils.replace(text, "'", "''")) : text;
}
{code}

  was:
The [current 
implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
 is only adding single quotes around the text:

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", text) : text;
}
{code}

So, getText for this string:
{code}
'this is a ''quoted'' word'
{code}
would return
{code}
'this is a 'quoted' word'
{code}

Something like this is necessary:

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", 
StringUtils.replace(text, "'", "''")) : text;
}
{code}



> Constants$Literal.getText does not escape ' chars
> -
>
> Key: CASSANDRA-17238
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17238
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Sina Siadat
>Priority: Normal
>
> The [current 
> implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
>  is only adding single quotes around the text:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", text) : text;
> }
> {code}
> So, getText for this string:
> {code:java}
> 'this is a ''quoted'' word'
> {code}
> would return
> {code:java}
> 'this is a 'quoted' word'
> {code}
> Maybe something like this would fix it, if necessary:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", 
> StringUtils.replace(text, "'", "''")) : text;
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17238) Constants$Literal.getText does not escape ' chars

2022-01-05 Thread Sina Siadat (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sina Siadat updated CASSANDRA-17238:

Description: 
The [current 
implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
 is only adding single quotes around the text:

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", text) : text;
}
{code}

So, getText for this string:
{code}
'this is a ''quoted'' word'
{code}
would return
{code}
'this is a 'quoted' word'
{code}

Something like this is necessary:

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", 
StringUtils.replace(text, "'", "''")) : text;
}
{code}


  was:
The [current 
implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
 is only adding single quotes around the text:

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", text) : text;
}
{code}

Something like this is necessary (I'm not sure if we need to do anything with 
the newline characters):

{code:java}
public String getText()
{
return type == Type.STRING ? String.format("'%s'", 
StringUtils.replace(text, "'", "''")) : text;
}
{code}


> Constants$Literal.getText does not escape ' chars
> -
>
> Key: CASSANDRA-17238
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17238
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Sina Siadat
>Priority: Normal
>
> The [current 
> implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
>  is only adding single quotes around the text:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", text) : text;
> }
> {code}
> So, getText for this string:
> {code}
> 'this is a ''quoted'' word'
> {code}
> would return
> {code}
> 'this is a 'quoted' word'
> {code}
> Something like this is necessary:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", 
> StringUtils.replace(text, "'", "''")) : text;
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17238) Constants$Literal.getText does not escape ' chars

2022-01-05 Thread Brandon Williams (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brandon Williams updated CASSANDRA-17238:
-
Resolution: Not A Problem
Status: Resolved  (was: Triage Needed)

This is used internally to get the text representation of CQL keywords which 
don't need this kind of protection.

> Constants$Literal.getText does not escape ' chars
> -
>
> Key: CASSANDRA-17238
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17238
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Sina Siadat
>Priority: Normal
>
> The [current 
> implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
>  is only adding single quotes around the text:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", text) : text;
> }
> {code}
> Something like this is necessary (I'm not sure if we need to do anything with 
> the newline characters):
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", 
> StringUtils.replace(text, "'", "''")) : text;
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17238) Constants$Literal.getText does not escape ' chars

2022-01-05 Thread Sina Siadat (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sina Siadat updated CASSANDRA-17238:

Component/s: (was: CQL/Semantics)

> Constants$Literal.getText does not escape ' chars
> -
>
> Key: CASSANDRA-17238
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17238
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Sina Siadat
>Priority: Normal
>
> The [current 
> implementation|https://sourcegraph.com/github.com/apache/cassandra@b83d722b99de79d131f58512564b901b11907182/-/blob/src/java/org/apache/cassandra/cql3/Constants.java?L358-361]
>  is only adding single quotes around the text:
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", text) : text;
> }
> {code}
> Something like this is necessary (I'm not sure if we need to do anything with 
> the newline characters):
> {code:java}
> public String getText()
> {
> return type == Type.STRING ? String.format("'%s'", 
> StringUtils.replace(text, "'", "''")) : text;
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org