Not knowing the exact internals of how it works...

Assuming that it works much the same way other RDB's
work in their native GL's (generation languages), the
common practice with a relational database is to define/declare
a "cursor" with the SQL statement executed against the database.
After the cursor is defined/declared, then the next operation
that is performed is a "fetch" where information that is available
by the "cursor" is actually pulled from the database and 
somehow used.  Specifically *how* I don't know.   

I remember years ago when doing COBOL programming, when
dealing with a random access indexed file, what we had to
do to get to the data was to...

   open indexedfile-name
   start indexedfile-name at a particular key value
     if error (the start was bad and you're record pointer was
               now at the end of the indexedfile)
        go back and get a new key value or end program
     if good (read operations can be performed to retrieve a
              record)
        continue

   looping paragraph
     (
      read recordname next
        at end
          close indexfile-name
      ....
      ....
      ....
     )

This is pretty much the same operation as is done with a 
RDB.  The open is the database/host/user connection.  The
start is the definition/declaration of the cursor, and the
read next's are the fetches that return values to be 
processed.

> -----Original Message-----
> From: Stephen Abshire [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 09, 2002 12:41 PM
> To: [EMAIL PROTECTED]
> Subject: Re: How Query and Fetch work?
> 
> 
> I like the explanation using the automobile and key. Very 
> good :-) Yet at 
> the same time if I understand what effect using the different 
> grades of fuel 
> in my car will have on its performance, I can optimize how 
> the car operates. 
> Much like the original question, if I know when MySQL caches 
> result sets and 
> when it is forced to hit the database again I can optimize 
> the performance 
> of my application.
> 
> Personally, I would like to know the answer to this question 
> myself. Anyone 
> know the internals?
> 
> 
> ----Original Message Follows----
> From: Dibo Chen <[EMAIL PROTECTED]>
> To: Alex Shi <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> Subject: Re: How Query and Fetch work?
> Date: Wed, 09 Jan 2002 10:45:07 -0600
> 
> When you are told to fill in fuel and turn the key to drive, I suppose
> you don't care how the fuel runs the car. Do the same things 
> in any lib
> you use, pushing the "buttons" in told order would  work. 
> Well, you may
> dig deeper if you like since the code is available.
> 
> Alex Shi wrote:
>  >
>  > Yesterday I posted a question yet got response. The question
>  > is regarding to how Query works. Now I repost it in a more
>  > specific way.
>  >
>  > I am just wondering how MySQL API functions work. Let's look
>  > at following two functions:
>  >
>  > 1. mysql_query(),
>  > 2. mysql_fetch_array()
>  >
>  > To my understanding, mysql_query() will definately to its job with
>  > MySQL server. But how about the latter? Does it just fetch data
>  > from client/local buffer, which is previously put in by 
> mysql_query(),
>  > or still has to goto server side to fetch data?
>  >
>  > Alex
>  >
>  > 
> ---------------------------------------------------------------------
>  > Before posting, please check:
>  >    http://www.mysql.com/manual.php   (the manual)
>  >    http://lists.mysql.com/           (the list archive)
>  >
>  > To request this thread, e-mail <[EMAIL PROTECTED]>
>  > To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
>  > Trouble unsubscribing? Try: 
http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
    http://www.mysql.com/manual.php   (the manual)
    http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail 
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to