Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  update.test  Sprache: unbekannt

 
Spracherkennung für: .test vermutete Sprache: SQL {SQL[156] ABAP[100] VDM[60]} [Methode: maximale Elemente, drei Dimensionen]

--source include/have_rocksdb.inc

# 
# Basic UPDATE statements.
# UPDATE LOW_PRIORITY is covered in update_low_prio test
# UPDATE IGNORE is covered in update_ignore test
# Multi-table update is covered in update_multi test
#

########################################
# TODO:
# The results of the transactional part
# are unusual due to "can't-see-own-changes"
########################################

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;

UPDATE t1 SET a=a+100;
--sorted_result
SELECT a,b FROM t1;

UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100;
--sorted_result
SELECT a,b FROM t1;

# ORDER BY and LIMIT
UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1;
--sorted_result
SELECT a,b FROM t1;

DROP TABLE t1;

# 
# Transactional UPDATE
#

CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;

BEGIN;
UPDATE t1 SET a=a+100;
UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100;
COMMIT;
--sorted_result
SELECT * FROM t1 ORDER BY pk;

BEGIN;
UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
UPDATE t1 SET b = '';
ROLLBACK;
SELECT * FROM t1 ORDER BY pk;

BEGIN;
UPDATE t1 SET b = 'update2' WHERE a <= 100;
SAVEPOINT spt1;
UPDATE t1 SET b = '';
--error ER_ROLLBACK_TO_SAVEPOINT
ROLLBACK TO SAVEPOINT spt1;
UPDATE t1 SET b = 'upd' WHERE a = 10050;
--error ER_ROLLBACK_ONLY
COMMIT;
SELECT * FROM t1 ORDER BY pk;

DROP TABLE t1;


#
# Issue #830 UPDATE with unique constraint does not work
#

CREATE TABLE t1 (a INT, b CHAR(8), UNIQUE INDEX(a)) ENGINE=RocksDB;
INSERT INTO t1 (a,b) VALUES (1,'foo'),(2,'bar');
UPDATE t1 SET a=a+100;
SELECT * FROM t1;
DROP TABLE t1;

[Dauer der Verarbeitung: 0.12 Sekunden, vorverarbeitet 2026-10-08]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691