Question

I'm hoping someone here might help me.

The company I work for would prefer that I use MySQL instead of MSSQL. So I downloaded the latest driver (6.1) and am porting the DB layer.

However I can not find the BeginExecuteReader function which takes a callback as parameter.

Is this for a reason? Or does it work differently with MySQL?

As far as I can see it, if the code doesn't raise a Callback, I would need to poll which makes it slow. Using a blocking thread per connection is also something I want to avoid.

Anyone ideas how to tackle this? (apart from altering the driver which is probably beyond my powers)

R

Was it helpful?

Solution

Version 6.3.4 of the MySQL Connector implements async methods but it seems that it only invokes a delegate asynchronously so it will be non-blocking to the calling thread but it won't save any threads from the ThreadPool. Here's the bug report about this.

And, like you said, it doesn't have a callback parameter. Here's the bug report about this.

I believe devart's data providers implement async methods properly, but they aren't free.

Anyway, async database calls do NOT imply better overall scalability by themselves. I recommend reading the article "Should my database calls be Asynchronous?" for an in-depth analysis.

OTHER TIPS

i don't know about this connector specifically, but every other connector i've seen for mysql just waits for the server to return the data during the execute() or query() call. the closest you'll get is using the "unbuffered" version, which returns immediately from execute() or query(), but blocks when you attempt to request the next row but it hasn't arrived from the mysql server yet.

MySQL thread support seems to me to basically be an afterthought.

You cannot, for example, via the C API, cancel an issued query; rather, the query function simply blocks. To make multiple concurrent queries, one thread is required per query!

Try using Postgres. I've not used it (the C API put me off - all those typedefs), but it certainly has proper support for multi-threaded queries (e.g. async calls, etc).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top