[SQL] Client and server cursors

Andreas Grosam agrosam at computerworks.ch
Wed Mar 5 17:13:00 CST 2003



On Mittwoch, 5. März 2003, Ruslan Zasukhin <sunshine at public.kherson.ua> wrote:
>on 3/5/03 3:49 AM, Andreas Grosam at agrosam at computerworks.ch
>wrote:
>
>> Client-Side Cursors:
>> -------------------
>> Advantages:
>> - For the Client, once loaded, it has quick access to the row values.
>> 
>> - For the server, it does not need to hold resources which may grow
>> significantly when managing a lot of server side cursors at once.
>> 
>> Disadvantage for the client:
>> - it MUST load all row data before it can process the result set.
>> - it is now responsible for managing the resources which requires dedicated
>> code on the client side.
>
>:-) and this is what I like in Valentina way.
>
>Valentina Client still will be very simple, because all this work will do
>VDKC_Cursor class.
>
>
>> For instance MySQL:
>> MySQL does only have Client-Side Cursors.
>        
>    you sure ?
>    It seems I have read about Server side cursors also in their docs.
>    Or this is not implemented yet ?
>
I recently read the doc for MySQL 4.0x - and Server-Side Cursors are on the ToDo List.

>> You have to choices for retriving
>> row data:
>> a) loading it ALL at once and let it manage by the client side
>> mysql_ResultSet. This simply allocates each column value on
>the heap.
>
>
>> b) fetching one row by one UNTIL ALL rows have been fetched. Then the client
>> application code is responsible for managing the data.
>
>Andreas, but this sounds like Sever-Side ForwardOnly cursors.
>No ?

YesNo.

Server versus Client Side Cursors says something bout the location of the resources which are required for the cursors to operate as long as it is opened.

If the server is not required to hold any resources when creating a cursor - there is no question of server or client side.

For instance, consider this simple query:
Select * from Persons;

If the cursor is specified Sensitive and not updateable and also shall have only forward iterator capabilities - then the server is not required to allocate any resources because it can select the candidate records for that cursor "on the fly" when the client fetches the rows.

The client does also not store the resources, otherwise it would not be sensitive.

As a result, no resources will be allocated at all.


If the cursor is now specified Insensitive, the server must guarantee this behavior by either creating the complete set and transfering  it all to the client which becomes responsible for the records (Client Side Cursor) or it must create a lokal copy of the records in the server side which then yields to a Server-Side Cursor.

Certainly, in any case, the server may or may not require to temporarily create and hold resources for creating the result set on the server side - but IMO, what counts is the fact which - Server or Client  - becomes responsibel after the creation of the result set and is responsible for it as long the cursor is opened.

If the server releases the resources on its side after they have been fetched from the cursor, then this is a Client-Side Cursor - which also implicitly means that the Client side is actually willing to manage the resources and become the owner of it once they have been fetched.

If a Cursor manages resources on the client side, even if the server was not required to hold and allocate resources while creating the result set - for instance, if it it was able to create the set on the fly, IMO this is a Client-Side Cursor since it manages resources while it is open on the client side.


Regards
Andreas

>
>> IMO, this is quite inconvenient since you HAVE to fetch all
>rows!!
>
>Agree with you
>
>-- 
>Best regards,
>Ruslan Zasukhin      [ I feel the need...the need for speed ]
>-------------------------------------------------------------
>e-mail: ruslan at paradigmasoft.com
>web: http://www.paradigmasoft.com
>
>To subscribe to the Valentina mail list go to:
>http://listserv.macserve.net/mailman/listinfo/valentina
>-------------------------------------------------------------
>
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina
>




More information about the Valentina mailing list