Because of deadlines, just to get this part working, i'm using the 
following code to generate my own sql statement to update the record 
directly (with ugly string concatenation etc). This feels wrong :-) 

            String oldSql = "select * from book where book_id = ?";
>             Record oldRecord = pool.fetchOne(oldSql, pk); 
>             //            
>             StringBuilder sb = new StringBuilder();
>             for (Field f : record.fields()) {
>                 if (Objects.equal(f.getValue(record), 
> f.getValue(oldRecord))) {
>                     continue; //skip 
>                 }
>                 if (sb.length() > 0) sb.append(", ");
>                 //
>                 sb.append(f.getName()).append("=");
>                 Object val = f.getValue(record);
>                 DataType dt = f.getDataType();
>                 if (val == null) {
>                     sb.append("null");
>                 } else if (dt.isString() || dt.isDateTime() || 
> dt.isTemporal()) {
>                     sb.append("'").append(val).append("'");
>                 } else {
>                     sb.append(val);
>                 }
>             }
>             String sql = "update book set " + sb.toString() + " where 
> book_id = ?";
>




-- 
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.

Reply via email to