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

update queries: strange behaviour on SET EXPR #158

Open
dbu opened this issue May 5, 2015 · 11 comments
Open

update queries: strange behaviour on SET EXPR #158

dbu opened this issue May 5, 2015 · 11 comments

Comments

@dbu
Copy link
Member

dbu commented May 5, 2015

i tried to run this query:

UPDATE [nt:unstructured] AS a INNER JOIN [nt:unstructured] AS t ON ISCHILDNODE(t, a) 
SET expr('row.getNode("t").setProperty("originalLinkCaption", row.getNode("a").getPropertyValue("originalLinkCaption"))') 
WHERE a.[phpcr:class] = 'Liipch\MagazineBundle\Document\Article' ;

but during the autosave i get the exception

[PHPCR\ValueFormatException] Invalid value for property ")": Object values must implement PHPCR\NodeInterface, PHPCR\PropertyInterface or be \DateTime, supplied argument is of class: PHPCR\Shell\Query\ColumnOperand

as SET EXPR does not exist, this should report an error instead of trying to do strange things. there is probably a problem with the query parser.

@dantleech
Copy link
Member

I don't think so.. looks like a parser issue. Maybe try escaping the quotations?

@dantleech
Copy link
Member

hmm .. i get the same issue

@dantleech
Copy link
Member

Try:

UPDATE [nt:unstructured] AS a INNER JOIN [nt:unstructured] AS t ON ISCHILDNODE(t, a) 
SET t.originalLinkCaption = EXPR('row.getNode("a").getPropertyValue("originalLinkCaption")') 
WHERE a.[phpcr:class] = 'Liipch\MagazineBundle\Document\Article' ;

@dbu
Copy link
Member Author

dbu commented May 5, 2015

i tried that, it leads to the bug described in #160

@dantleech
Copy link
Member

Hmm, it works for me locally (it parses the query and updates 0 rows). Are you using the latest version? (beta-3)

@dbu
Copy link
Member Author

dbu commented May 5, 2015 via email

@dbu
Copy link
Member Author

dbu commented May 5, 2015

ok, your proposal works. but the thing i reported still gives me the same on beta3 and i don't think i see a typo in there. so maybe a bug in the expression parser?

functions got case sensitive, so its actually expr and not EXPR

@dantleech
Copy link
Member

So you can update your content repository sucessfully?

Is the bug that it should be case insensative? (in addition to actually locating the exception class)

@dbu
Copy link
Member Author

dbu commented May 5, 2015

so the SET EXPR() syntax seems not case sensitive, but the a.field = expr() case only works lowercase. maybe that is by design - not sure but maybe functions should generally be case insensitive. would be more in line with the sql keywords being insenstitive.

a.field = expr() worked for me with beta3. SET EXPR() does not.

@dantleech
Copy link
Member

Hmm, well SET EXPR is invalid as SET is always field => value. We could implement APPLY EXPR()

@dbu
Copy link
Member Author

dbu commented May 5, 2015

oh, but then the parser is really not reporting that one well. it executed something and the error comes on the auto-save. i will adjust the ticket description then

@dbu dbu changed the title update queries: EXPR not working update queries: strange behaviour on SET EXPR May 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants