~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb/t/ndb_cursor.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_ndb.inc
 
2
-- source include/not_embedded.inc
 
3
 
 
4
--disable_warnings
 
5
drop table if exists t1;
 
6
drop table if exists t2;
 
7
--enable_warnings
 
8
 
 
9
create table t1 (
 
10
  a int not null primary key,
 
11
  b int not null
 
12
) engine=ndb;
 
13
 
 
14
create table t2 (
 
15
  a int not null primary key,
 
16
  b int not null
 
17
) engine=ndb;
 
18
 
 
19
insert into t1 values (1,10), (2,20), (3,30), (4, 40);
 
20
 
 
21
delimiter //;
 
22
create procedure test_cursor ()
 
23
begin
 
24
  declare done int default 0;
 
25
  declare temp_a int;
 
26
  declare temp_b int;
 
27
  declare cur1 cursor for select a,b from t1;
 
28
  declare continue handler for sqlstate '02000' set done = 1;
 
29
  open cur1;
 
30
  repeat
 
31
    fetch cur1 into temp_a, temp_b;
 
32
    if not done then
 
33
      insert into t2 values (temp_a, temp_b);
 
34
    end if;
 
35
  until done end repeat;
 
36
  close cur1;
 
37
end;
 
38
//
 
39
delimiter ;//
 
40
 
 
41
select * from t2 order by a;
 
42
call test_cursor();
 
43
select * from t2 order by a;
 
44
drop procedure test_cursor;
 
45
drop table t1,t2;
 
46
 
 
47
--echo end of 5.1 tests