Sorry, I was a bit hasty on the send button I must admit :-)
... these are the insert statements ...
DSL.using(getConf(con)).executeInsert(record);
DSL.using(getConf(con))
.insertInto(TABLE)
.set(record)
.execute();
... using the following configuration ...
Configuration configuration = new
DefaultConfiguration().set(con).set(SQLDialect.MYSQL);
configuration.set(new DefaultExecuteListenerProvider(new
PhoenixListener()));
... with the following listener ...
public class PhoenixListener extends DefaultExecuteListener {
@Override
public void start(ExecuteContext ctx) {
String sql = ctx.sql();
System.out.println(sql);
}
@Override
public void renderEnd(ExecuteContext ctx) {
String sql = ctx.sql();
sql = sql.replace("insert", "UPSERT");
sql = sql.replace("`", "");
ctx.sql(sql);
}
@Override
public void prepareEnd(ExecuteContext ctx) {
ctx.query();
String sql = ctx.sql();
sql = sql.replace("insert", "UPSERT");
sql = sql.replace("`", "");
ctx.sql(sql);
}
@Override
public void bindEnd(ExecuteContext ctx) {
String sql = ctx.sql();
System.out.println(sql);
}
}
On Wed, Jan 7, 2015 at 1:20 PM, Lukas Eder <[email protected]> wrote:
> Hi Kristoffer,
>
> We're more than happy to help, but it would be easier if you show us what
> you've tried so far... :)
>
> Cheers
> Lukas
>
> 2015-01-07 13:01 GMT+01:00 <[email protected]>:
>
>> Hi
>>
>> I'm trying to make a slight modification to the generated SQL from INSERT
>> to UPSERT but can't make it happen with ExecutionListeners (which works
>> fine for SELECT).
>>
>> The ExecutionListener is called but the changes does not affect the
>> actual statement that later get executed.
>>
>> Cheers,
>> -Kristoffer
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jOOQ User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jooq-user/-gI2yrEuaik/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.