Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute UPDATE PUT/ADD/INCREMENT #7651

Closed
publicocean0 opened this issue Aug 11, 2017 · 7 comments
Closed

Cannot execute UPDATE PUT/ADD/INCREMENT #7651

publicocean0 opened this issue Aug 11, 2017 · 7 comments
Assignees
Labels

Comments

@publicocean0
Copy link

publicocean0 commented Aug 11, 2017

OrientDB Version: 3

Java Version: 7

update ... add a = #4:3

give exception Cannot execute with UPDATE PUT/ADD/INCREMENT new executor.

how can i add a item to a set/list? why i can use remove 1 element and not insert 1 element ? It is a temporary bug?

for incrrement i can use :
update 48:24 set a = a+1 instead update 48:24 increment a = 1

@publicocean0 publicocean0 changed the title Cannot execute with UPDATE PUT/ADD/INCREMENT new executor Cannot execute with UPDATE PUT/ADD/INCREMENT Aug 11, 2017
@publicocean0 publicocean0 changed the title Cannot execute with UPDATE PUT/ADD/INCREMENT Cannot execute UPDATE PUT/ADD/INCREMENT Aug 11, 2017
@markk12
Copy link

markk12 commented Aug 12, 2017

i have the same problem. Passing from 2.x to 3.x ...
My scripts do not work anymore. In many cases, my db arrays contain 1000-10000 items, the idea of ​​passing the entire array each time to add only one item does not look so good.

@luigidellaquila
Copy link
Member

Hi @publicocean0

This is not a temporary bug, we changed the array syntax a little bit in 3.0, now it's much more flexible and you can add elements on the left on the right with the following:

UPDATE #48:24 SET a = a || #4:3

or

UPDATE #48:24 SET a = #4:3 || a

Full syntax here http://orientdb.com/docs/3.0.x/sql/SQL-Syntax.html#array-concatenation

I know these breaking changes can be a bit annoying during the migration, but we decided to invest a lot on SQL syntax in v 3.0 and we had to sacrifice something. Please check that docs page, you will find a lot of new functionalities

Thanks

Luigi

@publicocean0
Copy link
Author

cool :)

@publicocean0
Copy link
Author

publicocean0 commented Aug 14, 2017

ops similar problem with put ....
i tried with || dont works
i tried to search in that page sql syntax ... i dont found

update #4:0 put b = "a" , 3

@publicocean0 publicocean0 reopened this Aug 14, 2017
@luigidellaquila
Copy link
Member

Hi @publicocean0

UPDATE ... PUT foo = bar, baz

is just syntax sugar for

UPDATE ... SET foo.bar = baz

So you can just use this form

Thanks

Luigi

@publicocean0
Copy link
Author

publicocean0 commented Aug 14, 2017

ok thanks .... cool i like new syntax :)

if you could solve the problem also with lucene ... about searching inside field arrays and fiels hashmap having a specific key-vaue it would be great ....i could complete also a new feature i have in mind from long time ahaha

@ebingeorgedct
Copy link

how can i use isSet() in an update query. to add only if it does not exist in array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants