mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	BitKeeper/etc/gone: auto-union BitKeeper/etc/logging_ok: auto-union myisam/sort.c: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/update.result: Auto merged mysql-test/t/bdb-crash.test: Auto merged mysql-test/t/group_by.test: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/order_by.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/type_blob.test: Auto merged mysql-test/t/type_decimal.test: Auto merged mysql-test/t/type_ranges.test: Auto merged mysql-test/t/update.test: Auto merged sql-bench/crash-me.sh: Auto merged client/mysql.cc: Keep old code
		
			
				
	
	
		
			96 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			96 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #
 | |
| # test of updating of keys
 | |
| #
 | |
| 
 | |
| --disable_warnings
 | |
| drop table if exists t1,t2;
 | |
| --enable_warnings
 | |
| 
 | |
| create table t1 (a int auto_increment , primary key (a));
 | |
| insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); 
 | |
| update t1 set a=a+10 where a > 34;
 | |
| update t1 set a=a+100 where a > 0;
 | |
| 
 | |
| # Some strange updates to test some otherwise unused code
 | |
| update t1 set a=a+100 where a=1 and a=2;
 | |
| --error 1054
 | |
| update t1 set a=b+100 where a=1 and a=2; 
 | |
| --error 1054
 | |
| update t1 set a=b+100 where c=1 and a=2; 
 | |
| --error 1054
 | |
| update t1 set d=a+100 where a=1;
 | |
| select * from t1;
 | |
| drop table t1;
 | |
| 
 | |
| CREATE TABLE t1
 | |
|  (
 | |
|  place_id int (10) unsigned NOT NULL,
 | |
|  shows int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  ishows int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  ushows int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  clicks int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  iclicks int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  uclicks int(10) unsigned DEFAULT '0' NOT NULL,
 | |
|  ts timestamp(14),
 | |
|  PRIMARY KEY (place_id,ts)
 | |
|  );
 | |
| 
 | |
| INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
 | |
| VALUES (1,0,0,0,0,0,0,20000928174434);
 | |
| UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
 | |
| select place_id,shows from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Test bug with update reported by Jan Legenhausen
 | |
| #
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|   lfdnr int(10) unsigned NOT NULL default '0',
 | |
|   ticket int(10) unsigned NOT NULL default '0',
 | |
|   client varchar(255) NOT NULL default '',
 | |
|   replyto varchar(255) NOT NULL default '',
 | |
|   subject varchar(100) NOT NULL default '',
 | |
|   timestamp int(10) unsigned NOT NULL default '0',
 | |
|   tstamp timestamp(14) NOT NULL,
 | |
|   status int(3) NOT NULL default '0',
 | |
|   type varchar(15) NOT NULL default '',
 | |
|   assignment int(10) unsigned NOT NULL default '0',
 | |
|   fupcount int(4) unsigned NOT NULL default '0',
 | |
|   parent int(10) unsigned NOT NULL default '0',
 | |
|   activity int(10) unsigned NOT NULL default '0',
 | |
|   priority tinyint(1) unsigned NOT NULL default '1',
 | |
|   cc varchar(255) NOT NULL default '',
 | |
|   bcc varchar(255) NOT NULL default '',
 | |
|   body text NOT NULL,
 | |
|   comment text,
 | |
|   header text,
 | |
|   PRIMARY KEY  (lfdnr),
 | |
|   KEY k1 (timestamp),
 | |
|   KEY k2 (type),
 | |
|   KEY k3 (parent),
 | |
|   KEY k4 (assignment),
 | |
|   KEY ticket (ticket)
 | |
| ) TYPE=MyISAM;
 | |
| 
 | |
| INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
 | |
| 
 | |
| alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
 | |
| update t1 set status=1 where type='Open';
 | |
| select status from t1;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # Test of ORDER BY
 | |
| #
 | |
| 
 | |
| create table t1 (a int not null, b int not null);
 | |
| insert into t1 values (1,1),(1,2),(1,3);
 | |
| update t1 set b=4 where a=1 order by b asc limit 1;
 | |
| update t1 set b=4 where a=1 order by b desc limit 1;
 | |
| create table t2 (a int not null, b int not null);
 | |
| insert into t2 values (1,1),(1,2),(1,3);
 | |
| select * from t1;
 | |
| update t1 set b=(select distinct 1 from (select * from t2) a);
 | |
| drop table t1,t2;
 |