MySqlLoader and binary data
Posted: Tue 30 Jun 2020 15:57
I am using MySqlLoader to load a large number of rows into a table and the performance is awesome, but it does not seem to handle binary data properly.
I followed the example from the documentation.
Some pseudo code to illustrate:
Var loader = new MySqlLoader(...);
Loader.CreateColumns();
Loader.Open();
Foreach (var item in distinctItems)
{
loader.SetValue(“Size”, item.Size); // item.Size is a long
loader.SetValue(“Data”, item.Data); // item.Data is a byte[16]
loader.NextRow();
}
loader.Close();
What I observe:
1. Item.Data is truncated to 13 bytes on the first loop, most likely because it is not properly escaped. But I don’t see a way to escape it.
2. On the next loop the “Data” column is not updated so it properly inserts rows with new “Size” values but all the “Data” values matches the first row value
I tried representing item.Data as “X’[hex representation of item.Data]’” but that complained about the string being too long.
Any ideas would be appreciated.
Thank you
I followed the example from the documentation.
Some pseudo code to illustrate:
Var loader = new MySqlLoader(...);
Loader.CreateColumns();
Loader.Open();
Foreach (var item in distinctItems)
{
loader.SetValue(“Size”, item.Size); // item.Size is a long
loader.SetValue(“Data”, item.Data); // item.Data is a byte[16]
loader.NextRow();
}
loader.Close();
What I observe:
1. Item.Data is truncated to 13 bytes on the first loop, most likely because it is not properly escaped. But I don’t see a way to escape it.
2. On the next loop the “Data” column is not updated so it properly inserts rows with new “Size” values but all the “Data” values matches the first row value
I tried representing item.Data as “X’[hex representation of item.Data]’” but that complained about the string being too long.
Any ideas would be appreciated.
Thank you