[postgis-users] Loop or Cursor
Bob Pawley
rjpawley at shaw.ca
Tue Jul 21 08:18:35 PDT 2009
Hi Leo
I'm developing a geometric system as opposed to geographic (basically an engineering drawing).
I have a fixed field, representing a peice of paper, within which the user can add one to four objects.
These object are placed within the field according to the total number of objects.
The first object 'A' is placed in the center and then the user adds lines (one to eight at the moment) as attributes to the object.
When the user adds a second object, I want to update the attributes of object A to satisfy the new placement of object A.
When the user places a third object then both, object A and B, need to be updated.
At the moment, my updates haven't worked as I get either a null or multiple return.
Any suggestions for updating the lines for each object would be greatly appreciated.
Thanks
Bob
----- Original Message -----
From: Paragon Corporation
To: 'PostGIS Users Discussion'
Sent: Monday, July 20, 2009 7:45 PM
Subject: Re: [postgis-users] Loop or Cursor
What kind of operation? Even an update statement might suffice. There are many ways to cleverly control the flow of an update that do not necessitate doing a loop or cursor.
Also keep in mind even within a function used in a SELECT statement of a query, PostgreSQL allows you to run updates and do all sorts of crazy things like launch perl scripts and bash scripts. So for example you can mail to your whole membership simple by doing this
SELECT member_name, send_mail(member_id) As did_it_send
FROM membership
WHERE gross_income > 1000000 and active = true
It is very convenient for making rule processors.
Leo
------------------------------------------------------------------------------
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bob Pawley
Sent: Monday, July 20, 2009 1:43 PM
To: PostGIS Users Discussion
Subject: [postgis-users] Loop or Cursor
Hi
I need to access a number of rows, one at a time to perform an operation on each.
Under what conditions would I consider using a loop command, rather than (or with) a cursor?
Bob
------------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090721/6f581675/attachment.html>
More information about the postgis-users
mailing list