Re: New aggregating queries - API question

2017-01-14 Thread Nikita Timofeev
Thanks again! Quoting is somewhat I've completely forgotten about.

On Fri, Jan 13, 2017 at 9:42 PM, Andrus Adamchik  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 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  
>> 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  
>> 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


Re: New aggregating queries - API question

2017-01-13 Thread 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 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  
> 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  
> 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



Re: New aggregating queries - API question

2017-01-13 Thread 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  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