I found a workaround using the MERGE command

update V merge { "value2": "Hello\nWorld! Backslash = \\ " } where key = "x"


BUT there are other strange issues with escaped BACKSLASHES!

The following FAILS with java.lang.IllegalStateException: Missing closed 
string character: '"', position: 75
update V merge { "value2": "Backslash = \\" } where key = "x"

while this seems to work
update V merge { "value2": "Backslash = \\ " } where key = "x"

but when I want to update a javascript function, I have to escape each 
backslash twice !!!

The following will not behave as expected
update OFunction merge { code : "// \\/\\/" } where name = 
'testBackslashInComment'

A select query on the database will return
"code": "// //"
instead of the expected
"code": "// \\/\\/"

But the following query
update OFunction *merge* { code : "// \\\\/\\\\/" } where name = 
'testBackslashInComment'
will produce 
"code": "// \\/\\/"

But using SET instead of MERGE, we get:
update OFunction *set* code = "// \\/\\/" where name = 
'testBackslashInComment'
we get the expected 
"code": "// \\/\\/"

(but then we are back to the \n not working...)

So, could these problems be fixed?
They seem like bugs to me, and OrientDB studio is sufferering from the same 
problem when using backslahes in your javascript code (see ticket 
https://github.com/orientechnologies/orientdb-studio/issues/75)...





Op dinsdag 3 juni 2014 10:26:50 UTC+2 schreef MrFT:
>
> Hello,
> I am running queries through OrientDB studio, and I want to store newlines 
> in a property.
>
> I tried things like
>
> UPDATE MyClass set mytext = 'Hello*\n*World'
> and
> UPDATE MyClass set mytext = "Hello*\n*World"
>
> but no luck.
>
> How can this be done? Or is it a bug?
>
> (insert into MyClass content { key: 1, mytext: "Hello*\n*World" } does 
> work as expected... )
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to