ODB 3.0 SQL UPDATE - No more ADD|PUT?

59 views
Skip to first unread message

Eric24

unread,
Dec 30, 2017, 1:09:47 PM12/30/17
to OrientDB
According to the 3.0 documentation (http://orientdb.com/docs/3.0.x/sql/SQL-Update.html), ADD|PUT (and INCREMENT, which I don't use) have been removed from the SQL UPDATE syntax. Is there an alternative way in 3.0 to modify a Collection or Map, rather than overwrite it completely with SET?

Also, is there a document that describes all differences between 2.x and 3.0?

user.w...@gmail.com

unread,
Jan 2, 2018, 1:32:24 AM1/2/18
to OrientDB
Hi,

you can take a look at these links:



Here you can see all the differences / enhancement.

Hope it helps

Regards,

Michela

Luigi Dell'Aquila

unread,
Jan 2, 2018, 3:23:32 AM1/2/18
to orient-...@googlegroups.com
Hi Eric,

The alternatives are:


PUT: just use dot notation

UPDATE ADoc PUT aMap = "aKey", "aValue"

can be written as

UPDATE ADoc SET aMap.aKey = "aValue"
or
UPDATE ADoc SET aMap["aKey"] = "aValue"


ADD: use array concatenation ||

UPDATE ADoc PUT aList = "aValue"

can be written as

UPDATE ADoc SET aList = aList || "aValue"
or
UPDATE ADoc SET aList =  "aValue" || aList 
depending on where you want to add the value (first or last element of the list). For sets it does not make any difference of course


Thanks

Luigi


--

---
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 orient-database+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric24

unread,
Jan 20, 2018, 11:34:42 AM1/20/18
to OrientDB
Thanks Luigi; makes perfect sense. Is this syntax also supported on 2.2.x?
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.

Luigi Dell'Aquila

unread,
Jan 22, 2018, 12:23:40 PM1/22/18
to orient-...@googlegroups.com
Hi Eric,

The UPDATE SET syntax is allowed also in v 2.2.x, but the || operator is a new addition and won't be backported to 2.2

Thanks

Luigi


To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages