quotesorientdb

Escaping semicolon and quotes in OrientDB update operation


I'm running into strange errors when trying to update strings with both semicolons and quotes. For example, the following sql fails with the error:

"java.lang.IllegalStateException: Missing closed string character: '"', position: 64:

UPDATE #26:185 SET description = "<div style=\"text-align: right;\">Text</div>";

However, if removed the ';', the sql works:

UPDATE #26:185 SET description = "<div style=\"text-align: right\">Text</div>";

Also, if remove the escaped quotes, but the leave the ';', the sql works:

UPDATE #26:185 SET description = "Text;";

Is this a core issue with orientdb or am I not properly escaping the string?


Solution

  • I'm trying your case with OrientDB 2.1.11 version

    STRUCTURE:

    create class MyClass extends V
    create property MyClass.description string
    create vertex MyClass set description = "Text"
    

    MyClass dataset:

    select from MyClass
    
    ----+-----+-------+-----------
    #   |@RID |@CLASS |description
    ----+-----+-------+-----------
    0   |#12:0|MyClass|Text
    ----+-----+-------+-----------
    

    Now I update the record #12:0 with your first update query:

    UPDATE #12:0 SET description = "<div style=\"text-align: right;\">Text</div>";
    
    Updated record(s) '1' in 0,032000 sec(s).
    

    Updated MyClass dataset:

    select from MyClass
    
    ----+-----+-------+------------------------------------------
    #   |@RID |@CLASS |description
    ----+-----+-------+------------------------------------------
    0   |#12:0|MyClass|<div style="text-align: right;">Text</div>
    ----+-----+-------+------------------------------------------
    

    Probably the issue has been solved in the subsequent versions, could you try with the latest stable OrientDB version ?