@@ -6276,6 +6276,33 @@ public function testUserVariables(): void {
62766276 $ this ->assertEquals ( 3 , $ result [0 ]->{'@my_var ' } );
62776277 }
62786278
6279+ public function testVariableBackupAndRestoreForDumps (): void {
6280+ // Set and backup variables.
6281+ $ this ->assertQuery ( '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; ' );
6282+ $ this ->assertQuery ( '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; ' );
6283+ $ this ->assertQuery ( '/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; ' );
6284+ $ this ->assertQuery ( '/*!50503 SET NAMES utf8mb4 */; ' );
6285+ $ this ->assertQuery ( '/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; ' );
6286+ $ this ->assertQuery ( "/*!40103 SET TIME_ZONE='+00:00' */; " );
6287+ $ this ->assertQuery ( '/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; ' );
6288+ $ this ->assertQuery ( '/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; ' );
6289+ $ this ->assertQuery ( "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; " );
6290+ $ this ->assertQuery ( '/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; ' );
6291+ $ this ->assertQuery ( '/*!40101 SET @saved_cs_client = @@character_set_client */; ' );
6292+ $ this ->assertQuery ( '/*!50503 SET character_set_client = utf8mb4 */; ' );
6293+
6294+ // Restore variables.
6295+ $ this ->assertQuery ( '/*!40101 SET character_set_client = @saved_cs_client */; ' );
6296+ $ this ->assertQuery ( '/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; ' );
6297+ $ this ->assertQuery ( '/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; ' );
6298+ $ this ->assertQuery ( '/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; ' );
6299+ $ this ->assertQuery ( '/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; ' );
6300+ $ this ->assertQuery ( '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; ' );
6301+ $ this ->assertQuery ( '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; ' );
6302+ $ this ->assertQuery ( '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ' );
6303+ $ this ->assertQuery ( '/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; ' );
6304+ }
6305+
62796306 public function testLockingStatements (): void {
62806307 $ this ->assertQuery ( 'CREATE TABLE t (id INT) ' );
62816308
0 commit comments