Modified:
branches/5.2/CHANGES
branches/5.2/MySql.Data/Provider/Source/NativeDriver.cs
Log:
- fixed problem with execution of LOAD DATA LOCAL INFILE (which also affected MySqlBulkLoader). When the driver encountered some type of error opening the local file for transport it would still attempt to close the file which would yield a null reference exception (bug #43332)
Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES 2009-03-04 16:20:51 UTC (rev 1521)
+++ branches/5.2/CHANGES 2009-03-04 19:33:44 UTC (rev 1522)
@@ -14,6 +14,9 @@
when retrieving user id values. This would mean that in some cases methods like
ValidateUser would return success when they shouldn't. (bug #42574) This triggered several
other cleanups in all the providers
+- fixed problem with execution of LOAD DATA LOCAL INFILE (which also affected MySqlBulkLoader).
+ When the driver encountered some type of error opening the local file for transport it would
+ still attempt to close the file which would yield a null reference exception (bug #43332)
Version 5.2.5 - 11/14/2008
- fixed problem with package registration that kept the DDEX provider from working (bug #40726)
Modified: branches/5.2/MySql.Data/Provider/Source/NativeDriver.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/NativeDriver.cs 2009-03-04 16:20:51 UTC (rev 1521)
+++ branches/5.2/MySql.Data/Provider/Source/NativeDriver.cs 2009-03-04 19:33:44 UTC (rev 1522)
@@ -571,29 +571,26 @@
private void SendFileToServer(string filename)
{
byte[] buffer = new byte[8196];
- FileStream fs = null;
long len = 0;
try
{
- fs = new FileStream(filename, FileMode.Open);
- len = fs.Length;
- while (len > 0)
+ using (FileStream fs = new FileStream(filename, FileMode.Open))
{
- int count = fs.Read(buffer, 4, (int)(len > 8192 ? 8192 : len));
- stream.SendEntirePacketDirectly(buffer, count);
- len -= count;
+ len = fs.Length;
+ while (len > 0)
+ {
+ int count = fs.Read(buffer, 4, (int)(len > 8192 ? 8192 : len));
+ stream.SendEntirePacketDirectly(buffer, count);
+ len -= count;
+ }
+ stream.SendEntirePacketDirectly(buffer, 0);
}
- stream.SendEntirePacketDirectly(buffer, 0);
}
catch (Exception ex)
{
throw new MySqlException("Error during LOAD DATA LOCAL INFILE", ex);
}
- finally
- {
- fs.Close();
- }
}
public override bool SkipDataRow()
| Thread |
|---|
| • Connector/NET commit: r1522 - in branches/5.2: . MySql.Data/Provider/Source | rburnett | 4 Mar |