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

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb/t/ndb_limit.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 t2;
 
6
--enable_warnings
 
7
 
 
8
 
 
9
CREATE TABLE t2 (
 
10
  a bigint unsigned NOT NULL PRIMARY KEY,
 
11
  b int unsigned not null,
 
12
  c int unsigned
 
13
) engine=ndbcluster;
 
14
 
 
15
 
 
16
#
 
17
# insert records into table
 
18
#
 
19
let $1=1000;
 
20
disable_query_log;
 
21
while ($1)
 
22
{
 
23
 eval insert into t2 values($1*10, $1+9, 5*$1), ($1*10+1, $1+10, 7),($1*10+2, $1+10, 7*$1), ($1*10+3, $1+10, 10+$1), ($1*10+4, $1+10, 70*$1), ($1*10+5, $1+10, 7), ($1*10+6, $1+10, 9), ($1*10+7, $1+299, 899), ($1*10+8, $1+10, 12), ($1*10+9, $1+10, 14*$1);
 
24
 dec $1;
 
25
}
 
26
enable_query_log;
 
27
 
 
28
select count(*) from t2;
 
29
 
 
30
delete from t2 limit 1;
 
31
select count(*) from t2;
 
32
 
 
33
delete from t2 limit 100;
 
34
select count(*) from t2;
 
35
 
 
36
delete from t2 limit 1000;
 
37
select count(*) from t2;
 
38
 
 
39
update t2 set c=12345678 limit 100;
 
40
select count(*) from t2 where c=12345678;
 
41
select count(*) from t2 where c=12345678 limit 1000;
 
42
 
 
43
select * from t2 limit 0;
 
44
 
 
45
drop table t2;
 
46
 
 
47
CREATE TABLE `t2` (
 
48
  `views` int(11) NOT NULL default '0',
 
49
  `clicks` int(11) NOT NULL default '0',
 
50
  `day` date NOT NULL default '0000-00-00',
 
51
  `hour` tinyint(4) NOT NULL default '0',
 
52
  `bannerid` smallint(6) NOT NULL default '0',
 
53
  `zoneid` smallint(6) NOT NULL default '0',
 
54
  `source` varchar(50) NOT NULL default '',
 
55
  PRIMARY KEY  (`day`,`hour`,`bannerid`,`zoneid`,`source`),
 
56
  KEY `bannerid_day` (`bannerid`,`day`),
 
57
  KEY `zoneid` (`zoneid`)
 
58
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
 
59
 
 
60
INSERT INTO `t2` VALUES
 
61
(  1,0,'2004-09-17', 5,100,100,''),
 
62
(  1,0,'2004-09-18', 7,100,100,''),
 
63
( 17,0,'2004-09-27',20,132,100,''),
 
64
(  4,0,'2004-09-16',23,132,100,''),
 
65
( 86,0,'2004-09-18', 7,196,196,''),
 
66
( 11,0,'2004-09-16',16,132,100,''),
 
67
(140,0,'2004-09-18', 0,100,164,''),
 
68
(  2,0,'2004-09-17', 7,132,100,''),
 
69
(846,0,'2004-09-27',11,132,164,''),
 
70
(  1,0,'2004-09-18', 8,132,100,''),
 
71
( 22,0,'2004-09-27', 9,164,132,''),
 
72
(711,0,'2004-09-27', 9,100,164,''),
 
73
( 11,0,'2004-09-18', 0,196,132,''),
 
74
( 41,0,'2004-09-27',15,196,132,''),
 
75
( 57,0,'2004-09-18', 2,164,196,'');
 
76
 
 
77
SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
 
78
as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
 
79
 
 
80
SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
 
81
as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
 
82
 
 
83
drop table t2;
 
84
 
 
85
# End of 4.1 tests