>>>>> "Scott" == Scott Weikart <scott@stripped> writes:
Scott> Replying to my own message...
>>> In looking over our problems with Cold Fusion, it appears that MyODBC is
>>> singlethreaded.
>>
>> Here's the MyODBC maintainer's comments on threads:
>>
Ales> Hello,
Ales> is libmyodbc thread safe or I should wrap ODBC functions with mutexes?
Ales> I wrote a simple test program where 2 threads share ODBC environment
Ales> and connection and within their bodies thay keep running in loop doing
Ales> SQLAllocStmt,SQLExecDirect,SQLBindCol,SQLFetch and SQLFreeStmt. It
Ales> crashes within tens
Ales> of seconds. However, if I wrap SQLExecDirect with a mutex then the
>> test
Ales> seems to run
Ales> without problems. Where can I find out which functions from libmyodbc
>> are
Ales> safe to use directly within a multithreaded program?
>>
>> The MyODBC is thread safe if you use different connections. If two
>> threads access the same connection at the same time anything can
>> happen!
>>
>> As MyODBC reads all results sets into memory, it 'should' be thread safe
>> if you have a mutex around SQLExecDirect.
>>
>> Regards,
>> Monty
Scott> This makes me wonder whether it would be possible/desirable to put a mutex
Scott> around SQLExecDirect *inside* MyODBC. So that threaded applications using
Scott> MyODBC would always work.
Yes, this would be possible (and I have this on my TODO). On problem
is of course that if the application is not using different
connections, it will not get more performance by using
threads.
Regards,
Monty