SET @@storage_engine = Falcon;
#
# Bug #23818 Falcon: crash with random updates of long varchar columns
#      Second part. Original bug reports loops 100000 times.
#      Use character set LATIN1, loop more times
#
--echo *** Bug #23818_II ***
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
--enable_warnings

  CREATE TABLE t1 (a int, b varchar(1100) character set latin1, c varchar(10000));
  INSERT INTO t1 VALUES (null,null,null),(1,'',''),(2,'a','a');
  CREATE INDEX i1 ON t1 (b);

DELIMITER //;
CREATE PROCEDURE p1 ()
BEGIN
  declare v int default 0;
  while v < 1000 do
    SET @x = concat('update t1 set a = ', v,', b = repeat(0x', hex(rand()*255),',rand()*999), c = repeat(0x', hex(rand()*255), ',rand()*9999)');
    /* select v,@x; */
    PREPARE stmt1 FROM @x;
    EXECUTE stmt1;
    SET v = v + 1;
    END while;
  END//
CALL p1()//

# Final cleanup.
DELIMITER ;//
DROP TABLE t1;
DROP PROCEDURE p1;
