Hi Simone, 2014-03-26 10:59 GMT+01:00 Simone Giacomelli <[email protected]>:
> Hi Lukas, > > > >> Result<R> implements List<R> and Record has setValue() methods, so you >> can do anything you want with such results. E.g. >> >> result.get(0).setValue(TABLE.SEX, "Femmine") >> >> > This did the trick :) > > Beware that 'sex' field is VARCHAR(1) so I think there will not >>> be enough room to store 'Femmine' or 'Maschi' >>> >> >> jOOQ's in-memory model of Result doesn't care about the precision >> (although, this makes me think whether it should...). So as long as this >> stays in Java memory, you'll be on the safe side for now. >> > > Yes, I'm working only in memory and everything will remain there. > > >> However, I think you might be interested in "live data sets" that keep >> open cursors and store changes to the database. Is that so? In that case, >> the changes currently aren't stored back to the database. >> > > Nope, right now I'm looking only with small changes to in memory dataset > for presentation purposes. > > Another situation is where I have one Result with three columns and I >>> want to merge two of them in one new calculated column. >>> Is there a way for such programmatic manipulation? >>> >> >> Why not use SQL for that? :-) >> > > Because this calculations are quite simple but not so simple to be > comfortably expressed in sql; For example, I have a 'patient' table with > birth date. > With jOOQ and date-diff functions I can easily group by my 'patient' by > age in years. > I want to change the 0 age with 'less than 1 year' or '<1' > OK, I see, so that's a formatting thing, then. Fair enough. > There are other manipulations like month name decode (1=gennaio > 2=febbraio...) and I do not want to tamper with tested jOOQ queries but > instead do a post-processing. > I see. Well, for some of those use-cases, Converters might be a better choice. E.g. for (1=gennaio, etc.) why not create an enum or something like that and have jOOQ auto-convert values to those enums? See also: http://www.jooq.org/doc/latest/manual/code-generation/custom-data-types/ > > >> Otherwise, we have implemented #3139 to create new ad-hoc in-memory >> Result objects based on your own set of fields: >> https://github.com/jOOQ/jOOQ/issues/3139 >> > [...] >> Does this help? >> > > Yes! With this I think my post sql processing manipulations are done > > Thank you Lukas :) > > -- > 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 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.
