1drop table if exists t1; 2drop table if exists t2; 3## Creating new table t1 ## 4CREATE TABLE t1 5( 6id INT NOT NULL auto_increment, 7PRIMARY KEY (id), 8name VARCHAR(30) 9) ENGINE = INNODB; 10## Creating another new table t2 ## 11CREATE TABLE t2 12( 13id INT NOT NULL auto_increment, 14PRIMARY KEY (id), 15name VARCHAR(30) 16) ENGINE = INNODB; 17'#--------------------FN_DYNVARS_035_01-------------------------#' 18## It should be zero ## 19SELECT @@identity = 0; 20@@identity = 0 211 22connect test_con1, localhost, root,,; 23connection test_con1; 24SET @@autocommit = 0; 25## Inserting rows in table t1 ## 26INSERT into t1(name) values('Record_1'); 27INSERT into t1(name) values('Record_2'); 28INSERT into t1(name) values('Record_3'); 29## Verifying total values in t1 ## 30SELECT @@identity from t1; 31@@identity 323 333 343 35## Now inserting some data in table t2 ## 36INSERT into t2(name) values('Record_1'); 37## Verifying total values in t2 ## 38SELECT @@identity from t2; 39@@identity 401 41'#--------------------FN_DYNVARS_035_02-------------------------#' 42connect test_con2, localhost, root,,; 43connection test_con2; 44SELECT * from t1; 45id name 46## Verifying total values in t1 ## 47SELECT @@identity from t1; 48@@identity 49## Verifying total values in t2 ## 50SELECT @@identity from t2; 51@@identity 52## Inserting some more records in table t1 ## 53INSERT into t1(name) values('Record_1_1'); 54INSERT into t1(name) values('Record_1_2'); 55## Verifying total values in t1 ## 56SELECT @@identity from t1; 57@@identity 585 595 60## Inserting row in table t2 ## 61INSERT into t2(name) values('Record_1_3'); 62## Verifying total values in t2 ## 63SELECT @@identity from t2; 64@@identity 652 66'#--------------------FN_DYNVARS_035_03-------------------------#' 67connection test_con1; 68## Commiting rows added in test_con1 ## 69COMMIT; 70## Verifying records in both tables ## 71SELECT * from t1; 72id name 731 Record_1 742 Record_2 753 Record_3 764 Record_1_1 775 Record_1_2 78SELECT * from t2; 79id name 801 Record_1 812 Record_1_3 82## Verifying total values in t1 after commiting data ## 83SELECT @@identity from t1; 84@@identity 851 861 871 881 891 90## Verifying total values in t2 after commiting data ## 91SELECT @@identity from t2; 92@@identity 931 941 95INSERT into t1(name) values('Record_4'); 96## Now verifying value of variable after inserting 1 row in this connection ## 97SELECT @@identity from t1; 98@@identity 996 1006 1016 1026 1036 1046 105## Dropping tables t1 & t2 ## 106drop table t1, t2; 107disconnect test_con1; 108disconnect test_con2; 109