List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:November 30 2010 6:28pm
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:849) Bug#58373
View as plain text  
#At file:///C:/work/connector-net/6.0/ based on revid:reggie.burnett@stripped

  849 Reggie Burnett	2010-11-30
      - fixed ReadFieldLength to return a long so bigint autoincrement columns can work (bug #58373)

    modified:
      CHANGES
      MySql.Data/Provider/Source/MySqlPacket.cs
      MySql.Data/Provider/Source/NativeDriver.cs
      MySql.Data/Provider/Source/Types/MySqlBinary.cs
      MySql.Data/Provider/Source/Types/MySqlBit.cs
      MySql.Data/Provider/Source/Types/MySqlDecimal.cs
      MySql.Data/Provider/Source/Types/MySqlGuid.cs
      MySql.Data/Provider/Source/Types/MySqlString.cs
      MySql.Data/Tests/Source/DataTypeTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-11-22 17:21:10 +0000
+++ b/CHANGES	2010-11-30 18:28:31 +0000
@@ -9,6 +9,7 @@
 - return default values for text columns as quoted (bug #58167)
 - fixed our DDEX code so that dragging tables from server explorer onto a typed data set
   preserves the table name (bug #57894)
+- fixed ReadFieldLength to return a long so bigint autoincrement columns can work (bug #58373)
 
 Version 6.0.7
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data/Provider/Source/MySqlPacket.cs'
--- a/MySql.Data/Provider/Source/MySqlPacket.cs	2010-04-27 16:16:29 +0000
+++ b/MySql.Data/Provider/Source/MySqlPacket.cs	2010-11-30 18:28:31 +0000
@@ -146,7 +146,7 @@
 
         #region Integer methods
 
-        public int ReadFieldLength()
+        public long ReadFieldLength()
         {
             byte c = ReadByte();
 
@@ -155,7 +155,7 @@
                 case 251: return -1;
                 case 252: return ReadInteger(2);
                 case 253: return ReadInteger(3);
-                case 254: return ReadInteger(8);
+                case 254: return ReadLong(8);
                 default: return c;
             }
         }

=== modified file 'MySql.Data/Provider/Source/NativeDriver.cs'
--- a/MySql.Data/Provider/Source/NativeDriver.cs	2010-06-25 21:35:03 +0000
+++ b/MySql.Data/Provider/Source/NativeDriver.cs	2010-11-30 18:28:31 +0000
@@ -617,7 +617,7 @@
             int length = -1;
             if (nullMap == null)
             {
-                length = packet.ReadFieldLength();
+                length = (int)packet.ReadFieldLength();
                 if (length == -1) return;
             }
             if (length > -1)

=== modified file 'MySql.Data/Provider/Source/Types/MySqlBinary.cs'
--- a/MySql.Data/Provider/Source/Types/MySqlBinary.cs	2010-02-26 21:18:30 +0000
+++ b/MySql.Data/Provider/Source/Types/MySqlBinary.cs	2010-11-30 18:28:31 +0000
@@ -175,7 +175,7 @@
 
 		void IMySqlValue.SkipValue(MySqlPacket packet)
 		{
-            int len = packet.ReadFieldLength();
+            int len = (int)packet.ReadFieldLength();
             packet.Position += len;
 		}
 

=== modified file 'MySql.Data/Provider/Source/Types/MySqlBit.cs'
--- a/MySql.Data/Provider/Source/Types/MySqlBit.cs	2010-10-06 20:34:20 +0000
+++ b/MySql.Data/Provider/Source/Types/MySqlBit.cs	2010-11-30 18:28:31 +0000
@@ -109,7 +109,7 @@
 
 		public void SkipValue(MySqlPacket packet)
 		{
-            int len = packet.ReadFieldLength();
+            int len = (int)packet.ReadFieldLength();
             packet.Position += len;
 		}
 

=== modified file 'MySql.Data/Provider/Source/Types/MySqlDecimal.cs'
--- a/MySql.Data/Provider/Source/Types/MySqlDecimal.cs	2010-02-26 21:18:30 +0000
+++ b/MySql.Data/Provider/Source/Types/MySqlDecimal.cs	2010-11-30 18:28:31 +0000
@@ -132,7 +132,7 @@
 
         void IMySqlValue.SkipValue(MySqlPacket packet)
 		{
-            int len = packet.ReadFieldLength();
+            int len = (int)packet.ReadFieldLength();
             packet.Position += len;
 		}
 

=== modified file 'MySql.Data/Provider/Source/Types/MySqlGuid.cs'
--- a/MySql.Data/Provider/Source/Types/MySqlGuid.cs	2010-02-26 21:18:30 +0000
+++ b/MySql.Data/Provider/Source/Types/MySqlGuid.cs	2010-11-30 18:28:31 +0000
@@ -161,7 +161,7 @@
 
 		void IMySqlValue.SkipValue(MySqlPacket packet)
 		{
-            int len = packet.ReadFieldLength();
+            int len = (int)packet.ReadFieldLength();
             packet.Position += len;
 		}
 

=== modified file 'MySql.Data/Provider/Source/Types/MySqlString.cs'
--- a/MySql.Data/Provider/Source/Types/MySqlString.cs	2010-02-26 21:18:30 +0000
+++ b/MySql.Data/Provider/Source/Types/MySqlString.cs	2010-11-30 18:28:31 +0000
@@ -114,7 +114,7 @@
 
 		void IMySqlValue.SkipValue(MySqlPacket packet)
 		{
-            int len = packet.ReadFieldLength();
+            int len = (int)packet.ReadFieldLength();
             packet.Position += len;
 		}
 

=== modified file 'MySql.Data/Tests/Source/DataTypeTests.cs'
--- a/MySql.Data/Tests/Source/DataTypeTests.cs	2010-08-03 15:55:53 +0000
+++ b/MySql.Data/Tests/Source/DataTypeTests.cs	2010-11-30 18:28:31 +0000
@@ -976,5 +976,24 @@
                 Assert.AreEqual(d, double.MaxValue);
             }
         }
+
+        /// <summary>
+        /// Bug #58373	ReadInteger problem
+        /// </summary>
+        [Test]
+        public void BigIntAutoInc()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL("CREATE TABLE test(ID bigint unsigned AUTO_INCREMENT NOT NULL PRIMARY KEY, name VARCHAR(20))");
+
+            MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES (@id, 'boo')", conn);
+            ulong val = UInt64.MaxValue;
+            val -= 100;
+            cmd.Parameters.AddWithValue("@id", val);
+            cmd.ExecuteNonQuery();
+
+            cmd.CommandText = "INSERT INTO test (name) VALUES ('boo2')";
+            cmd.ExecuteNonQuery();
+        }
     }
 }


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20101130182831-ntrccil3mi81vhgw.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:849) Bug#58373Reggie Burnett30 Nov