#At file:///H:/connector_net/6.1/ based on revid:vvaintroub@stripped
793 Vladislav Vaintroub 2009-11-30 [merge]
merge
modified:
CHANGES
MySql.Data/Provider/Source/NativeDriver.cs
MySql.Data/Tests/Source/BulkLoading.cs
=== modified file 'CHANGES'
--- a/CHANGES 2009-11-03 17:58:32 +0000
+++ b/CHANGES 2009-11-30 15:31:48 +0000
@@ -11,6 +11,8 @@ Version 6.1.3
- fixed unsigned types in views when used as entities (bug # 47872)
- now exposing the MySqlDecimal type along with GetMySqlDecimal methods on data reader (bug #48100)
- applied user-suggested patch to enable type-safe cloning (bug #48460)
+- when sending file to server (LOAD DATA INFILE) open the file for read only, not for read/write
+ (bug #48944)
Version 6.1.2
- fixed hanging after losing network connectivity to server (bug#43761)
=== modified file 'MySql.Data/Provider/Source/NativeDriver.cs'
--- a/MySql.Data/Provider/Source/NativeDriver.cs 2009-11-11 17:28:51 +0000
+++ b/MySql.Data/Provider/Source/NativeDriver.cs 2009-11-30 15:31:48 +0000
@@ -586,7 +586,8 @@ namespace MySql.Data.MySqlClient
long len = 0;
try
{
- using (FileStream fs = new FileStream(filename, FileMode.Open))
+ using (FileStream fs = new FileStream(filename, FileMode.Open,
+ FileAccess.Read))
{
len = fs.Length;
while (len > 0)
=== modified file 'MySql.Data/Tests/Source/BulkLoading.cs'
--- a/MySql.Data/Tests/Source/BulkLoading.cs 2008-05-22 17:41:55 +0000
+++ b/MySql.Data/Tests/Source/BulkLoading.cs 2009-11-30 15:29:51 +0000
@@ -55,6 +55,44 @@ namespace MySql.Data.MySqlClient.Tests
Assert.AreEqual(200, dt.Rows.Count);
Assert.AreEqual("'Test'", dt.Rows[0][1].ToString().Trim());
}
+
+ [Test]
+ public void BulkLoadReadOnlyFile()
+ {
+ execSQL("CREATE TABLE Test (id INT NOT NULL, name VARCHAR(250), PRIMARY KEY(id))");
+
+ // first create the external file
+ string path = Path.GetTempFileName();
+ StreamWriter sw = new StreamWriter(path);
+ for (int i = 0; i < 200; i++)
+ sw.WriteLine(i + "\t'Test'");
+ sw.Flush();
+ sw.Close();
+
+ FileInfo fi = new FileInfo(path);
+ FileAttributes oldAttr = fi.Attributes;
+ fi.Attributes = fi.Attributes | FileAttributes.ReadOnly;
+ try
+ {
+ MySqlBulkLoader loader = new MySqlBulkLoader(conn);
+ loader.TableName = "Test";
+ loader.FileName = path;
+ loader.Timeout = 0;
+ int count = loader.Load();
+ Assert.AreEqual(200, count);
+
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
+ DataTable dt = new DataTable();
+ da.Fill(dt);
+ Assert.AreEqual(200, dt.Rows.Count);
+ Assert.AreEqual("'Test'", dt.Rows[0][1].ToString().Trim());
+ }
+ finally
+ {
+ fi.Attributes = oldAttr;
+ fi.Delete();
+ }
+ }
[Test]
public void BulkLoadSimple2()
Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20091130153148-mwrac2844puvsf1p.bundle
| Thread |
|---|
| • bzr commit into connector-net-6.1 branch (vvaintroub:793) | Vladislav Vaintroub | 30 Nov |