Re: Porting Code to Postgresql

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Porting Code to Postgresql
Date: 2003-10-16 03:16:10
Message-ID: 3F8E0D7A.4090809@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Welty wrote:

>[taking this offlist]
>
>On Wed, 15 Oct 2003 19:51:00 -0700 Dennis Gearon <gearond(at)fireserve(dot)net> wrote:
>
>
>>In a for loop, you *always* execute the body of the loop one time, as
>>far as I know. So if you have no rows, you would then have a problem.
>>That is why I put the WHILE at the top.
>>
>>
>
>in some languages, for loops have this problem. this is why i reviewed two
>php references to double check my facts before i posted my followup, and
>both claimed that in php, the test is at the top of the loop.
>
>i can code something up and test it you like.
>
>richard
>
>
You're right! I looked up
http://www.php.net/for
and found it.
Apparently C also does the test at the top of the loop
http://www.acm.uiuc.edu/webmonkeys/book/c_guide/1.6.html

Well, that will simplify a lot of my future code :-)

--
"You are behaving like a man",
is an insult from some women,
a compliment from an good woman.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-10-16 03:51:51 Re: Getting error codes for failed queries?
Previous Message Stephan Szabo 2003-10-16 03:02:36 Re: SET within a function?