groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Champeau <cedric.champ...@gmail.com>
Subject Re: @compileStatic and groovy.sql
Date Fri, 24 Jun 2016 13:34:26 GMT
For type safe sql those days I would recommend to use jOOQ.
Le 23 juin 2016 06:58, "Wilson MacGyver" <wmacgyver@gmail.com> a écrit :

> Ouch.... I will continue to embrace dynamic then :)
>
> On Wed, Jun 22, 2016 at 1:56 PM Guillaume Laforge <glaforge@gmail.com>
> wrote:
>
>> Perhaps a custom type checker extension could be fed with the jdbc
>> metadata...
>> Le 22 juin 2016 7:41 PM, "Shil Sinha" <shil.sinha@gmail.com> a écrit :
>>
>>> Hi Marc,
>>>
>>> You could use the map access syntax i.e. foo['id'] instead and
>>> cast/coerce the result to the appropriate type.
>>>
>>> On Wed, Jun 22, 2016 at 1:37 PM Wilson MacGyver <wmacgyver@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> If I want to use compileStatic with groovy.sql, how would I do that?
>>>>
>>>>
>>>> the problem as far as I can tell is
>>>>
>>>> sql.eachRow("select id,.... from whatever") { foo ->
>>>> ...
>>>>   foo.id
>>>> }
>>>>
>>>> returns data that is known at runtime
>>>>
>>>> but at compile time. there is no way to know that the SQL statement
>>>> returns a
>>>> id column.
>>>>
>>>> is there a way to do it?
>>>>
>>>> Thanks,
>>>> Mac
>>>>
>>>> --
>>>> Omnem crede diem tibi diluxisse supremum.
>>>>
>>>

Mime
View raw message