List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:August 3 2010 9:30pm
Subject:bzr commit into connector-net-trunk branch (vvaintroub:915)
View as plain text  
#At file:///H:/connector_net/trunk/ based on revid:vvaintroub@stripped

  915 Vladislav Vaintroub	2010-08-03 [merge]
      merge

    modified:
      CHANGES
      MySql.Web/Providers/Source/SessionProvider.cs
=== modified file 'CHANGES'
--- a/CHANGES	2010-08-03 16:04:09 +0000
+++ b/CHANGES	2010-08-03 21:29:59 +0000
@@ -1,3 +1,4 @@
+- Fix calculation of lockAge in SessionProvider (Bug #55701)
 - Handle cases where server returns unparsable (out-of-range) double values
   (Bug#55644)
 - Fix DataAdapter.Update() slowdown due to many superfluous DataTable.AcceptChanges() calls (Bug #55609)
@@ -5,7 +6,6 @@
 - Improve performance of write operaitons (e.g insert) if compression is enabled (Bug #48243)
 
 Version 6.3.3 (beta 2)
-- fix "There is already an open DataReader..." after exceptions in DataReader.Close()
 - fix "There is already an open DataReader..." after exceptions in DataReader.Close()
  (bug#55558)
 - Improve performance of MySqlHelper.EscapeString()

=== modified file 'MySql.Web/Providers/Source/SessionProvider.cs'
--- a/MySql.Web/Providers/Source/SessionProvider.cs	2010-04-21 17:47:38 +0000
+++ b/MySql.Web/Providers/Source/SessionProvider.cs	2010-08-03 21:29:59 +0000
@@ -520,8 +520,8 @@ namespace MySql.Web.SessionState
 
                     // Retrieve the current session item information.
                     cmd = new MySqlCommand(
-                      "SELECT (NOW() > Expires) as Expired, SessionItems, LockId,  Flags, Timeout, " +
-                      "  TIME_TO_SEC(NOW() - LockDate) as lockAge " +
+                      "SELECT NOW(), Expires , SessionItems, LockId,  Flags, Timeout, " +
+                      "  LockDate " +
                       "  FROM my_aspnet_Sessions" +
                       "  WHERE SessionId = @SessionId AND ApplicationId = @ApplicationId", conn);
 
@@ -533,8 +533,9 @@ namespace MySql.Web.SessionState
                     {
                         if (reader.Read())
                         {
-                            bool expired = reader.GetBoolean(0);
-                            if (expired)
+                            DateTime now = reader.GetDateTime(0);
+                            DateTime expires = reader.GetDateTime(1);
+                            if (now.CompareTo(expires) > 0)
                             {
                                 //The record was expired. Mark it as not locked.
                                 locked = false;
@@ -546,15 +547,16 @@ namespace MySql.Web.SessionState
                                 foundRecord = true;
                             }
 
-                            object items = reader.GetValue(1);
+                            object items = reader.GetValue(2);
                             serializedItems = (items is DBNull) ? null : (byte[])items;
-                            lockId = reader.GetValue(2);
+                            lockId = reader.GetValue(3);
                             if (lockId is DBNull)
                                 lockId = (int)0;
 
-                            actionFlags = (SessionStateActions)(reader.GetInt32(3));
-                            timeout = reader.GetInt32(4);
-                            lockAge = new TimeSpan(0, 0, 0, reader.GetInt32(5));
+                            actionFlags = (SessionStateActions)(reader.GetInt32(4));
+                            timeout = reader.GetInt32(5);
+                            DateTime lockDate = reader.GetDateTime(6);
+                            lockAge = now.Subtract(lockDate);
                         }
                     }
 


Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20100803212959-p2iu2ga0s9ohzc6e.bundle
Thread
bzr commit into connector-net-trunk branch (vvaintroub:915) Vladislav Vaintroub3 Aug