pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DBD::Pg ... how would I format this prepare?
6+ messages / 5 participants
[nested] [flat]

* DBD::Pg ... how would I format this prepare?
@ 2006-07-26 21:29 Marc G. Fournier <scrappy@postgresql.org>
  2006-07-26 21:57 ` Re: DBD::Pg ... how would I format this prepare? Tom Lane <tgl@sss.pgh.pa.us>
  2006-07-26 22:09 ` Re: DBD::Pg ... how would I format this prepare? Jim Buttafuoco <jim@contactbda.com>
  2006-07-31 11:56 ` Re: DBD::Pg ... how would I format this prepare? Mathieu Arnold <mat@mat.cc>
  2006-07-31 15:30 ` Re: DBD::Pg ... how would I format this prepare? Harald Fuchs <hf0731x@protecting.net>
  0 siblings, 4 replies; 6+ messages in thread

From: Marc G. Fournier @ 2006-07-26 21:29 UTC (permalink / raw)
  To: pgsql-sql


I need to do:

NOW() + '2 day'::interval

where 2 is a variable ...

if I do:

NOW() + '? day'::interval

it, of course, takes the ? as a literal ... so is there some way I can do 
this such that I can do the placeholder?

Thx

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email . scrappy@hub.org                              MSN . scrappy@hub.org
Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: DBD::Pg ... how would I format this prepare?
  2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
@ 2006-07-26 21:57 ` Tom Lane <tgl@sss.pgh.pa.us>
  3 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2006-07-26 21:57 UTC (permalink / raw)
  To: Marc G. Fournier <scrappy@postgresql.org>; +Cc: pgsql-sql

"Marc G. Fournier" <scrappy@postgresql.org> writes:
> if I do:
> NOW() + '? day'::interval
> it, of course, takes the ? as a literal ... so is there some way I can do 
> this such that I can do the placeholder?

NOW() + n * '1 day'::interval

n can be any numeric value ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: DBD::Pg ... how would I format this prepare?
  2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
@ 2006-07-26 22:09 ` Jim Buttafuoco <jim@contactbda.com>
  2006-07-27 00:05   ` Re: DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
  3 siblings, 1 reply; 6+ messages in thread

From: Jim Buttafuoco @ 2006-07-26 22:09 UTC (permalink / raw)
  To: Marc G. Fournier <scrappy@postgresql.org>; pgsql-sql

try 

now() + (? || ' day')::interval


---------- Original Message -----------
From: "Marc G. Fournier" <scrappy@postgresql.org>
To: pgsql-sql@postgresql.org
Sent: Wed, 26 Jul 2006 18:29:32 -0300 (ADT)
Subject: [SQL] DBD::Pg ... how would I format this prepare?

> I need to do:
> 
> NOW() + '2 day'::interval
> 
> where 2 is a variable ...
> 
> if I do:
> 
> NOW() + '? day'::interval
> 
> it, of course, takes the ? as a literal ... so is there some way I can do 
> this such that I can do the placeholder?
> 
> Thx
> 
> ----
> Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
> Email . scrappy@hub.org                              MSN . scrappy@hub.org
> Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
------- End of Original Message -------




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: DBD::Pg ... how would I format this prepare?
  2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
  2006-07-26 22:09 ` Re: DBD::Pg ... how would I format this prepare? Jim Buttafuoco <jim@contactbda.com>
@ 2006-07-27 00:05   ` Marc G. Fournier <scrappy@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Marc G. Fournier @ 2006-07-27 00:05 UTC (permalink / raw)
  To: Jim Buttafuoco <jim@contactbda.com>; +Cc: pgsql-sql

On Wed, 26 Jul 2006, Jim Buttafuoco wrote:

> try
>
> now() + (? || ' day')::interval

Perfect ... had thought of that, but put my ) after ::interval instead of 
before ;(

Thx ...


>
>
> ---------- Original Message -----------
> From: "Marc G. Fournier" <scrappy@postgresql.org>
> To: pgsql-sql@postgresql.org
> Sent: Wed, 26 Jul 2006 18:29:32 -0300 (ADT)
> Subject: [SQL] DBD::Pg ... how would I format this prepare?
>
>> I need to do:
>>
>> NOW() + '2 day'::interval
>>
>> where 2 is a variable ...
>>
>> if I do:
>>
>> NOW() + '? day'::interval
>>
>> it, of course, takes the ? as a literal ... so is there some way I can do
>> this such that I can do the placeholder?
>>
>> Thx
>>
>> ----
>> Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
>> Email . scrappy@hub.org                              MSN . scrappy@hub.org
>> Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: Have you checked our extensive FAQ?
>>
>>                http://www.postgresql.org/docs/faq
> ------- End of Original Message -------
>
>

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email . scrappy@hub.org                              MSN . scrappy@hub.org
Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: DBD::Pg ... how would I format this prepare?
  2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
@ 2006-07-31 11:56 ` Mathieu Arnold <mat@mat.cc>
  3 siblings, 0 replies; 6+ messages in thread

From: Mathieu Arnold @ 2006-07-31 11:56 UTC (permalink / raw)
  To: pgsql-sql

+-le 26/07/2006 18:29 -0300, Marc G. Fournier a dit :
| 
| I need to do:
| 
| NOW() + '2 day'::interval
| 
| where 2 is a variable ...
| 
| if I do:
| 
| NOW() + '? day'::interval
| 
| it, of course, takes the ? as a literal ... so is there some way I can do
| this such that I can do the placeholder?

I think that ! is what you're looking for.

-- 
Mathieu Arnold



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: DBD::Pg ... how would I format this prepare?
  2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
@ 2006-07-31 15:30 ` Harald Fuchs <hf0731x@protecting.net>
  3 siblings, 0 replies; 6+ messages in thread

From: Harald Fuchs @ 2006-07-31 15:30 UTC (permalink / raw)
  To: pgsql-sql

In article <20060726182806.A1188@ganymede.hub.org>,
"Marc G. Fournier" <scrappy@postgresql.org> writes:

> I need to do:

> NOW() + '2 day'::interval

> where 2 is a variable ...

> if I do:

> NOW() + '? day'::interval

> it, of course, takes the ? as a literal ... so is there some way I can
> do this such that I can do the placeholder?

How about the following?

  now() + ? * '1 day'::interval




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2006-07-31 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-26 21:29 DBD::Pg ... how would I format this prepare? Marc G. Fournier <scrappy@postgresql.org>
2006-07-26 21:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-07-26 22:09 ` Jim Buttafuoco <jim@contactbda.com>
2006-07-27 00:05   ` Marc G. Fournier <scrappy@postgresql.org>
2006-07-31 11:56 ` Mathieu Arnold <mat@mat.cc>
2006-07-31 15:30 ` Harald Fuchs <hf0731x@protecting.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox