DBI and placeholders question

From: mike <mike(at)redtux1(dot)uklinux(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: DBI and placeholders question
Date: 2005-02-14 18:41:59
Message-ID: 1108406519.9335.17.camel@datacc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it possible to have a placeholder on the left side of a select
criteria?

eg:

SELECT CASE WHEN date_part('dow',?::date)=5

this bit is fine

THEN CASE WHEN ? = 2 OR ? =3 OR ?=6 OR ?=7 OR ?=8 OR ?=12 THEN '7:00'

here the ? is being read as NULL ie, output from LOG

SELECT CASE WHEN date_part('dow', '2005-02-28'::date)=5 THEN CASE WHEN
NULL = 2 OR NULL =3 OR NULL=6 OR NULL=7 OR NULL=8 OR NULL=12 THEN
'7:00' WHEN NULL = 1 OR NULL =5 OR NULL=13 THEN '3:30' ELSE NULL
END

I am getting the ? translated as nulls

apologies for off-topic, but any help appreciated

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-02-14 18:55:47 Re: possible bug with compound index.
Previous Message Tom Lane 2005-02-14 16:45:06 Re: SQL Injection possible on custom functions