From 8a8155f11fd290a95951d41aa29e94fa9f346101 Mon Sep 17 00:00:00 2001
From: Sneha Modi <sneha.modi@oracle.com>
Date: Wed, 21 Dec 2011 15:14:55 +0530
Subject: [PATCH] Bug#11754150: A TEST CASE FOR BUG#6857 IS DISABLED IN SP.TEST

The time comparison using current_time() stored in an int variable was giving wrong results as
the current_time() format as an int implementation has been changed in mysql-trunk but not in mysql-5.5.

The time is stored in the format hh:mm:ss as 'time' datatype.But as an int, it is stored as hhmmss,
but only on the trunk. On mysql-5.5,as an int, it is stored as hh.
Hence, the current_time() function has been changed to unix_timestamp() function.
---
 mysql-test/r/sp.result | 7 +++++--
 mysql-test/t/sp.test   | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 1644c76443..a48f82af91 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -2776,16 +2776,19 @@ create procedure bug6857(counter int)
 begin
 declare t0, t1 int;
 declare plus bool default 0;
-set t0 = current_time();
+set t0 = unix_timestamp();
 while counter > 0 do
 set counter = counter - 1;
 end while;
-set t1 = current_time();
+set t1 = unix_timestamp();
 if t1 > t0 then
 set plus = 1;
 end if;
 select plus;
 end|
+call bug6857(300000)|
+plus
+1
 drop procedure bug6857|
 drop procedure if exists bug8757|
 create procedure bug8757()
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 3f6c50a909..6ac88f4f5b 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -3341,11 +3341,11 @@ begin
   declare t0, t1 int;
   declare plus bool default 0;
 
-  set t0 = current_time();
+  set t0 = unix_timestamp();
   while counter > 0 do
     set counter = counter - 1;
   end while;
-  set t1 = current_time();
+  set t1 = unix_timestamp();
   if t1 > t0 then
     set plus = 1;
   end if;
@@ -3357,7 +3357,7 @@ end|
 #     painful.
 # Make sure this takes at least one second on all machines in all builds.
 # 30000 makes it about 3 seconds on an old 1.1GHz linux.
-#call bug6857(300000)|
+call bug6857(300000)|
 
 drop procedure bug6857|
 
-- 
2.30.9