On 6/1/04 4:06 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> From: Gerard Samuel <[EMAIL PROTECTED]>
> Date: Tue, 1 Jun 2004 10:12:22 -0400
> To: [EMAIL PROTECTED]
> Subject: Using Cursors
> 
> A bit off topic, but lately I've been running into situations, where I have
> to know about using cursors with databases, like sql server, ibm db2....
> Can anyone point me to online resources that explains (to a practical newbie)
> "cursors"
> 
> Thanks
> 

I think that in PHP or other languages where you embed SQL into that
language cursors are less useful.  Cursors allow you to put a collection of
rows into a holder and walk through them (something earlier SQL did not
allow).

In the DBA community cursors are debated - I think because non-SQL
programmers tend to think in terms of walking a list doing something to each
row (record) while SQL programmers tend to like the SQL style of doing
everything to every record in the set at once.

But in PHP when you run a query and have a results set - you essentially
have a cursor (yes there are some important differences - true cursors live
in the DB and have more abilities).  But think of cursors just like your
results set - you define them by running a SELECT statement and the results
are put into this cursor and now you can run a loop of some kind on that
cursor.

Personally I can't remember the last time I used one, but I know I have used
one - I remember looking it up.

Frank

-- 
Frank Flynn
Poet, Artist & Mystic

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to