Re: PreparedStatement error upon trying to set a '?' after interval keyword

Поиск
Список
Период
Сортировка
От javadesigner
Тема Re: PreparedStatement error upon trying to set a '?' after interval keyword
Дата
Msg-id 53EE2B73.4060308@yahoo.com
обсуждение исходный текст
Ответ на Re: PreparedStatement error upon trying to set a '?' after interval keyword  (Sehrope Sarkuni <sehrope@jackdb.com>)
Список pgsql-jdbc
Sehrope, Craig:

Thanks a ton for your help. And hopefully this thread (and these
detailed answers) will be searchable for people who may have similar
questions in the future.

Best,
-j

Sehrope Sarkuni wrote:
> Yes Craig's way is better. I was only thinking of handling the string
> interpolation itself rather than generating the interval itself.
>
> I'd probably use the ::interval cast syntax though, so something like:
> checkin_time>  (CURRENT_DATE - (? * '1 day'::interval))
>
> Regards,
> -- Sehrope Sarkuni
> Founder&  CEO | JackDB, Inc. | http://www.jackdb.com/
>
> On Tue, Aug 12, 2014 at 12:02 AM, Craig Ringer<craig@2ndquadrant.com>  wrote:
>> On 08/12/2014 04:34 AM, Sehrope Sarkuni wrote:
>>>      AND checkin_time>  (CURRENT_DATE - (? || ' days')::interval)
>>
>> It's generally preferable to write
>>
>> (? * INTERVAL '1' DAY)
>>
>> instead.
>>
>> --
>>   Craig Ringer                   http://www.2ndQuadrant.com/
>>   PostgreSQL Development, 24x7 Support, Training&  Services


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Christian Schlichtherle
Дата:
Сообщение: Re: java.sql.Statement.isClosed() throws an SQLException if the statement is closed
Следующее
От: Barry Bell
Дата:
Сообщение: Re: [ODBC] BIRT report opening multiple connections