Kaloyan Iliev Iliev wrote:

Hi,

I have an idea about your problem. Will it be difficult not to change the entire code but only the queries? You can change type in the Postgres to bool. Then, when select data you can use a CASE..WHEN to return 'Y' or 'N' or even write a little function which accepts bool and returns 'Y' or 'N'. In this case in all your queries you will have to replace the select of bool field with select form the function.

Thank you for your suggestion. I had a private message exchange with Harald Fuchs who suggested the same (except the function). Here is what whe "exchanged":


Harald Fuchs wrote:

If you can control the SELECTs, just use

 SELECT CASE col WHEN true THEN 'Y' ELSE 'N' END

instead of

 SELECT col

Thus you wouldn't need to change your application code.


I use single SELECT for both PostgreSQL and MySQL. I could use your solution. It would just require some tagging of bool fields in SELECTs so I could add the CASE statement in case I use PostgreSQL backend.

Miroslav
begin:vcard
fn;quoted-printable:Miroslav =C5=A0ulc
n;quoted-printable:=C5=A0ulc;Miroslav
org:StartNet s.r.o.
adr;quoted-printable;quoted-printable:;;Vrchlick=C3=A9ho 161/5;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+420 257 225 602
tel;cell:+420 603 711 413
x-mozilla-html:TRUE
url:http://www.startnet.cz
version:2.1
end:vcard

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to