How do we stream data from MySQL? Traditionally, developers have
thought that they can simply use their API's cursor-equivalent
object (e.g. resultset) and move through the results.
Unfortunately, this does not do streaming in most cases. Normally
most client libraries (which call mysql_store_result) will read
the entire result into memory, and you're just going through an
already-in-memory data set. This will fail if it doesn't fit in
memory.
Enter mysql_use_result - if your library can use
this instead of mysql_store_result, you can then skip through the
records without needing to keep them all in ram at once.
However, there is some bad news - while going through a result
set in mysql_use_result, you can't do any OTHER queries on the
connection. An attempt to do so generally violates MySQL's
protocol and fails. So if you need to do other …
Showing entries 1 to 1
Apr
25
2010
Showing entries 1 to 1