empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele <doeb...@esteam.de>
Subject re: Support for Update of Composite Primary Key
Date Wed, 16 Nov 2016 07:19:34 GMT
Hi Daniel,

this is an interesting one.

The one thing that is currently not supported is the inner part of your subquery:

        VALUES
        ('xxx', 'yyy'),
        ('zzz', 'ttt')

But in theory you should be able to make your own subquery class by subclassing DBQuery and
overriding addSQL(StringBuilder buf, long context).
Then you can use this as show in the example SampleAdvApp.querySample();

This seems like a feasible approach to me – although I haven’t tried.

Regards,
Rainer

from: Daniel Weidele [mailto:daniel.weidele@gmail.com]
to: user@empire-db.apache.org
subject: Support for Update of Composite Primary Key

Hi,
I am wondering if there is some support for a query in this style:
UPDATE  t
SET     value = 99
FROM    (
        VALUES
        ('xxx', 'yyy'),
        ('zzz', 'ttt')
        ) v (in_x, in_y)
JOIN    mytable t
ON      t.x = in_x
        AND t.y = in_y

This *batch* updates particular rows of a table (e.g. with composite primary key), where the
row identifiers are given input.
I am curious about your thoughts on this!
Cheers,
Daniel
Mime
View raw message