Re: Porting Code to Postgresql - Mailing list pgsql-general

From Dennis Gearon
Subject Re: Porting Code to Postgresql
Date
Msg-id 3F8E0D7A.4090809@fireserve.net
Whole thread Raw
In response to Porting Code to Postgresql  (Errol Neal <sysadmins@enhtech.com>)
List pgsql-general
Richard Welty wrote:

>[taking this offlist]
>
>On Wed, 15 Oct 2003 19:51:00 -0700 Dennis Gearon <gearond@fireserve.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.



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: SET within a function?
Next
From: Tom Lane
Date:
Subject: Re: Getting error codes for failed queries?