Dear ROOTers,
I use ROOT to access a mysql database. When creating prepared statements that insert several rows at once, I come accross a problem where the BLOBs are empty.
An example is attached that shows the exact problem. I build one or several statements (depends on nbBlocks) that should insert x>10 rows (depends on nbObjPerBlock), each row made of a varchar, a timestamp and a blob. I end up with a query such as
REPLACE INTO test (moname, updatetime, data) VALUES (?, ?, ?), (?, ?, ?), (? ,?, ?)...
The example is out of context and therefore look a bit awkward (prepared statement used only once…), sorry about that. Nevertheless if you create the table as described in the source and run the example, you will see that the 10 first rows are properly inserted but not the following ones even though the names and dates are still ok. Only the blobs are affected. See here :
mysql> select moname, updatetime, octet_length(data) from test order by moname;
+--------+---------------------+--------------------+
| moname | updatetime | octet_length(data) |
+--------+---------------------+--------------------+
| test0 | 2009-01-01 01:01:01 | 1052 |
| test1 | 2009-01-01 01:01:01 | 1052 |
| test10 | 2009-01-01 01:01:01 | 0 |
| test11 | 2009-01-01 01:01:01 | 0 |
| test12 | 2009-01-01 01:01:01 | 0 |
| test13 | 2009-01-01 01:01:01 | 1052 |
| test14 | 2009-01-01 01:01:01 | 1052 |
| test15 | 2009-01-01 01:01:01 | 1052 |
| test16 | 2009-01-01 01:01:01 | 1052 |
| test17 | 2009-01-01 01:01:01 | 1052 |
What is even more strange is that the number of rows it can successfully insert depends on the program and not on the size of the objects. In the framework AMORE (ALICE collaboration) we can see this happen for the rows > 47 but this also depends on the user code…
Finally, if the example seems to work on your computer, add a loop and run it many times, and increase the number of rows in the insert. This happened to me.
I really don’t see if the bug is in my code or (sorry) in ROOT.
Any help is more than welcome,
Thanks
Barth
testMysql.C (3.1 KB)