Re: perl and postgresql

From: "Ville Jungman" <ville_jungman(at)hotmail(dot)com>
To: kkeller-postgres(at)wombat(dot)san-francisco(dot)ca(dot)us, pgsql-novice(at)postgresql(dot)org
Subject: Re: perl and postgresql
Date: 2003-03-19 02:28:42
Message-ID: F1240CaQv2u6Heluki400007dec@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> > is much simpler than same query with placeholders. That's why I like to
>do
> > it with sub like this.
>
>It's not really that much easier

"But I'm used to this and it would be pain if I had to move back", yelled
Tim Toady, calmed down and continued: "Look at this call ripped from my
embperl-file:

$subs->kanta("
select k.varaus_alkaa from kaavakkeet_tiedot t,kaavakkeet k
where t.ref_kaavakkeet=k.id and k.varaus_alkaa <= $loppuaika
and k.varaus_alkaa >= $alkuaika and t.ref_tuotteet=$ref_tuotteet

union

select k.varaus_paattyy from kaavakkeet_tiedot t,kaavakkeet k
where t.ref_kaavakkeet=k.id and k.varaus_paattyy <= $loppuaika
and k.varaus_paattyy >= $alkuaika and t.ref_tuotteet=$ref_tuotteet
");

You can't say that this would be clear to debug with placeholders. At least
if You'll someday study some Finnish the query above will look very clear -
so thinking failures are rare (or could be if some other than me was
programming). Queries are also much faster to write if they are many (like
with my current projects).

You (and [the other replyer called perhaps] Antti) are right in many things
about migrating, de facto standards etc. I'll keep them in mind. Also I
might have to convert the queries to use placeholders later - but only if
it'll make the sub faster. Perhaps i'll learn if something bad happens
because of my non-standard behaviours. Finally, I think that my sub was a
little bit insane == it just made what is asked.

Thank You for Your suggestions and advices."

---
Ville Jungman
Finland

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

Browse pgsql-novice by date

  From Date Subject
Next Message Sunil Gollapaly 2003-03-19 02:34:10 Regardin storing images
Previous Message Keith Keller 2003-03-18 23:50:55 Re: perl and postgresql