TOPIC: Functions in update queries
#1672
Functions in update queries 8 Months, 3 Weeks ago
I'm trying a query in "View Query" :

update address set street = street.Replace(',','.')

But it complains that there is a syntax error near @Replace, can we use regular functions on queries or should iterate over the records and execute it one by one ?
 
 
#1674
Re:Functions in update queries 8 Months, 3 Weeks ago
Currently the query expression syntax is a bit limited. You can only call simple functions, not methods. So you would need to define:

MyReplace

function (s) { s.Replace(',', '.') }


and then do:

update address set street = MyReplace(street)

It would not be too hard to extend the query expression syntax, I just have not got around to it.

Currently, query expressions are compiled to an AST. Index usage is extracted from the AST and then the remainder is interpreted. One option would be to convert the remainder back to an expression and then compile that. Then you would not need an interpreter for the AST.

If you are running standalone then there is not much difference between using QueryApply or an update query. But when running client-server it is more efficient to use an update query (less network traffic).
 
 
andrew