home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / replace.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  976 b   |  37 lines  |  [TEXT/ttxt]

  1. -- source include/have_isam.inc
  2.  
  3. #
  4. # Test of REPLACE with ISAM and MyISAM and HEAP
  5. #
  6.  
  7. drop table if exists t1;
  8.  
  9. CREATE TABLE t1 (
  10.   gesuchnr int(11) DEFAULT '0' NOT NULL,
  11.   benutzer_id int(11) DEFAULT '0' NOT NULL,
  12.   PRIMARY KEY (gesuchnr,benutzer_id)
  13. ) type=ISAM;
  14.  
  15. replace into t1 (gesuchnr,benutzer_id) values (2,1);
  16. replace into t1 (gesuchnr,benutzer_id) values (1,1);
  17. replace into t1 (gesuchnr,benutzer_id) values (1,1);
  18. alter table t1 type=myisam;
  19. replace into t1 (gesuchnr,benutzer_id) values (1,1);
  20. alter table t1 type=heap;
  21. replace into t1 (gesuchnr,benutzer_id) values (1,1);
  22. drop table t1;
  23.  
  24. #
  25. # Test when using replace on a key that has used up it's whole range
  26. #
  27.  
  28. create table t1 (a tinyint not null auto_increment primary key, b char(20));
  29. insert into t1 values (126,"first"),(0,"last");
  30. --error 1062
  31. insert into t1 values (0,"error");
  32. --error 1062
  33. replace into t1 values (0,"error");
  34. replace into t1 values (126,"first updated");
  35. select * from t1;
  36. drop table t1;
  37.