Passing quoted strings to methods removes quotes.
See original GitHub issueExpected behavior and actual behavior
When passing a quoted string to a function the function should use the quoted version of the string. Instead the quotes seem to be stripped.
Steps to reproduce the problem
Run the following SQL.
DROP CLASS test;
CREATE CLASS test;
CREATE PROPERTY test.id String;
CREATE PROPERTY test.value String;
INSERT INTO test SET id = "1", value = "Test 1: ";
UPDATE test SET value = value.append("\"double quotes\"") WHERE id = "1";
INSERT INTO test SET id = "2", value = "Test 2: ";
UPDATE test SET value = value.append("'single quotes'") WHERE id = "2";
INSERT INTO test SET id = "3", value = "Test 3: ";
UPDATE test SET value = value.append("\"mixed quotes'") WHERE id = "3";
INSERT INTO test SET id = "4", value = "Test 4: ";
UPDATE test SET value = value.append("\"one quote") WHERE id = "4";
INSERT INTO test SET id = "5", value = "Test 5: ";
UPDATE test SET value = value.append("\"nested \"quotes\" in quotes\"") WHERE id = "5";
SELECT * FROM test;
Output:
Test 1: double quotes
- Both surrounding quotes are stripped
Test 2: single quotes
- Both surrounding quotes are stripped
Test 3: "mixed quotes’
- Both quotes left
Test 4: "one quote
- preceding quote intact
Test 5: nested “quotes” in quotes
- Outer quotes are stripped, inner quotes are left.
It seems that this might be a parser issue given the sensitivity to matched quotes and the fact that only outer quotes are being stripped. This is not unique to the append method, it also was noted in “right”, and “substring” as well.
Also, when doing an INSERT, the quotes seem to be just fine, so it appears to be related to quoted strings passed to functions.
Important Questions
None
Runninng Mode
- Embedded, using PLOCAL access mode
- [ X] Embedded, using MEMORY access mode
- Remote
Misc
- I have a distributed setup with multiple servers. How many?
- I’m using the Enterprise Edition
OrientDB Version
- v2.0.x - Please specify last number:
- v2.1.x - Please specify last number:
- [X ] v2.2.x - Please specify last number: 2.2.0
Operating System
- Linux
- [ X] MacOSX
- Windows
- Other Unix
- Other, name?
Java Version
- 6
- 7
- [ X] 8
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Pass quotes and spaces in strings to functions in Rational ...
When a quote is required in any string or a space is required in an unquoted string then special handling rules must be...
Read more >Passing String Values with Embedded Quotes
1. Determine how the value appears in the database: · 2. Enclose the string value in quotes that are appropriate for your query...
Read more >I want to remove double quotes from a String - Stack Overflow
The pattern matches both the quotes and what's inbetween them, but replaces it only with what's in between the quotes, thus effectively removing...
Read more >Remove Beginning and Ending Double Quotes from a String
In this tutorial, we'll study different approaches for removing beginning and ending double quotes from a String in Java.
Read more >JavaScript Strings: The Basic Methods and Functions
Strings in JavaScript are contained within a pair of either single quotation marks '' or double quotation marks "". Both quotes represent Strings...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @mmacfadden
I pushed a fix on both 3.0 and 3.1 branches
Thanks
Luigi
@luigidellaquila Thanks!