New aggregating queries - API question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

New aggregating queries - API question

Andrus Adamchik
@Nikita:

ObjectSelect.column(..) is protected, so I can't use it for a single-column query. Is this intentional?

Thanks,
Andrus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New aggregating queries - API question

Nikita Timofeev
Hi Andrus,

It should be public. Lost it after splitting away ColumnSelect. Thank
you for catch!

On Fri, Jan 13, 2017 at 7:57 PM, Andrus Adamchik <[hidden email]> wrote:
> @Nikita:
>
> ObjectSelect.column(..) is protected, so I can't use it for a single-column query. Is this intentional?
>
> Thanks,
> Andrus



--
Best regards,
Nikita Timofeev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New aggregating queries - API question

Andrus Adamchik
Thanks for clarification and the fix.

Just found another issue - when "Quote SQL Identifiers" is on, the generated SQL is incorrect. I guess the function should not be placed in quotations. E.g. here is a MySQL example:

  Property<Long> count = Property.create(FunctionExpressionFactory.countExp(), Long.TYPE);
  ObjectSelect.query(MyType.class).column(count).selectOne(context);

  bootique-http-38 o.a.c.l.CommonsJdbcEventLogger: SELECT `COUNT(*)` FROM `my_table` `t0`
  bootique-http-38 o.a.c.l.CommonsJdbcEventLogger: *** error.  
  com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'COUNT(*)' in 'field list'

Andrus

> On Jan 13, 2017, at 12:25 PM, Nikita Timofeev <[hidden email]> wrote:
>
> Hi Andrus,
>
> It should be public. Lost it after splitting away ColumnSelect. Thank
> you for catch!
>
> On Fri, Jan 13, 2017 at 7:57 PM, Andrus Adamchik <[hidden email]> wrote:
>> @Nikita:
>>
>> ObjectSelect.column(..) is protected, so I can't use it for a single-column query. Is this intentional?
>>
>> Thanks,
>> Andrus
>
>
>
> --
> Best regards,
> Nikita Timofeev

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New aggregating queries - API question

Nikita Timofeev
Thanks again! Quoting is somewhat I've completely forgotten about.

On Fri, Jan 13, 2017 at 9:42 PM, Andrus Adamchik <[hidden email]> wrote:

> Thanks for clarification and the fix.
>
> Just found another issue - when "Quote SQL Identifiers" is on, the generated SQL is incorrect. I guess the function should not be placed in quotations. E.g. here is a MySQL example:
>
>   Property<Long> count = Property.create(FunctionExpressionFactory.countExp(), Long.TYPE);
>   ObjectSelect.query(MyType.class).column(count).selectOne(context);
>
>   bootique-http-38 o.a.c.l.CommonsJdbcEventLogger: SELECT `COUNT(*)` FROM `my_table` `t0`
>   bootique-http-38 o.a.c.l.CommonsJdbcEventLogger: *** error.
>   com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'COUNT(*)' in 'field list'
>
> Andrus
>
>> On Jan 13, 2017, at 12:25 PM, Nikita Timofeev <[hidden email]> wrote:
>>
>> Hi Andrus,
>>
>> It should be public. Lost it after splitting away ColumnSelect. Thank
>> you for catch!
>>
>> On Fri, Jan 13, 2017 at 7:57 PM, Andrus Adamchik <[hidden email]> wrote:
>>> @Nikita:
>>>
>>> ObjectSelect.column(..) is protected, so I can't use it for a single-column query. Is this intentional?
>>>
>>> Thanks,
>>> Andrus
>>
>>
>>
>> --
>> Best regards,
>> Nikita Timofeev
>



--
Best regards,
Nikita Timofeev
Loading...