> > I have 2 different result sets, since are two different connections to
> > the server, simultaneous but independent (two handles, two connections,
> > two different queries)
>
> what is the code you're using ?

in a very small representation the program is this

*** dbmail and dbmail2 open 2 different connections, one accesses 
DBM_ADDRESSES table and the other accesses DBM_NAMES table. The first one 
retrieves addresses from the table DBM_ADDRESSES, the second one a relationed 
names to the addresses from DBM_NAMES. Not all addresses have name set, so 
for questions of space I separated into tables, just 10% of addresses have a 
name and it would be waste of space having that column in the same table 
(90%+ of over 50,000 rows), so I created a new table for the names and linked 
them to a corresponding address via an 'id'

DBM_ADDRESSES
id, address, ...

DBM_NAMES
id,name

1. connect dbmail and dbmail2 to server
2. dbmail.query:   SELECT id,address from DBM_ADDRESSES WHERE ...
    sp_id = atoll(record[0]); // stores the id in 'sp_id'
3. while ( dbmail retrieves rows from query at step 2 ) {
   dbmail2.query:
   3.1 SELECT name FROM DBM_NAMES WHERE id=sp_id(from step 2)
   3.2 if ( name exists for id=sp_id )
           do something with DBM_ADDRESSES.address,DBM_NAMES.name
        else
           do something with DBM_ADDRESSES.address
   3.3 free results from dbmail2.query (inside while)
   }
4. free results from dbmail.query (1st query before while) ***CRASH***
5. disconnect dbmail and dbmail2 connections

The crash is in step #4 after  all data is retrieved successfully, but why? 
every loop in the while is performed a query/free without problems, but the 
most external unique query does not accept mysql_free_result(), even when 
they are two different connections to the server.

I've just tested with a single query program (one connection with one query) 
and it crashed too when I mysql_free_result() ***called only once*** after 
retrieving all rows:

1. query: SELECT ...
2. while ( fetch rows ) { use the results }
3. mysql_free_result()

it crashes too, this model is very (really very simple) and does not leave 
space for errors in code and still fails on the free function...

I've asked on a linux list and somebody told me just to avoid using 
mysql_free_result() if the program works that way ('cos the results maybe are 
being already free by the library), but I don't think it is a solution, I 
want to know what happens, if really the set is free automatically by the C 
API functions after reading it or not, and if so, why the documentation tells 
that it is a *must* call the free function after the whole set of rows is 
retrieved...

Thanks for your comments


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to