db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r170097 - in /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/autoincrement.out tests/lang/autoincrement.sql
Date Fri, 13 May 2005 21:41:17 GMT
Author: bandaram
Date: Fri May 13 14:41:17 2005
New Revision: 170097

URL: http://svn.apache.org/viewcvs?rev=170097&view=rev
Log:
Add multi connection test for identity_val_local() function.

Submitted by Mamta Satoor (msatoor@gmail.com)

Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/autoincrement.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/autoincrement.sql

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/autoincrement.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/autoincrement.out?rev=170097&r1=170096&r2=170097&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/autoincrement.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/autoincrement.out
Fri May 13 14:41:17 2005
@@ -1379,4 +1379,60 @@
 0 rows inserted/updated/deleted
 ij> drop table t3;
 0 rows inserted/updated/deleted
-ij> 
+ij> -- test IDENTITY_VAL_LOCAL function with 2 different connections
+-- connection one
+connect 'wombat' as conn1;
+ij(CONN1)> create table t1 (c11 int generated always as identity (start with 101, increment
by 3), c12 int);
+0 rows inserted/updated/deleted
+ij(CONN1)> create table t2 (c21 int generated always as identity (start with 201, increment
by 5), c22 int);
+0 rows inserted/updated/deleted
+ij(CONN1)> -- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into
table with identity column yet on this connection conn1
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+NULL                           
+ij(CONN1)> commit;
+ij(CONN1)> -- connection two
+connect 'wombat' as conn2;
+ij(CONN2)> -- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into
table with identity column yet on this connection conn2
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+NULL                           
+ij(CONN2)> insert into t2 (c22) values (1);
+1 row inserted/updated/deleted
+ij(CONN2)> -- IDENTITY_VAL_LOCAL() will return 201 because there was single row insert
into table t2 with identity column on this connection conn2
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+201                            
+ij(CONN2)> set connection conn1;
+ij(CONN1)> -- IDENTITY_VAL_LOCAL() will continue to return NULL because no single row
insert into table with identity column yet on this connection conn1
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+NULL                           
+ij(CONN1)> insert into t1 (c12) values (1);
+1 row inserted/updated/deleted
+ij(CONN1)> -- IDENTITY_VAL_LOCAL() will return 101 because there was single row insert
into table t1 with identity column on this connection conn1
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+101                            
+ij(CONN1)> set connection conn2;
+ij(CONN2)> -- IDENTITY_VAL_LOCAL() on conn2 not impacted by single row insert into table
with identity column on conn1
+values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+201                            
+ij(CONN2)> -- notice that committing the transaction does not affect IDENTITY_VAL_LOCAL()
+commit;
+ij(CONN2)> values IDENTITY_VAL_LOCAL();
+1                              
+-------------------------------
+201                            
+ij(CONN2)> drop table t1;
+0 rows inserted/updated/deleted
+ij(CONN2)> drop table t2;
+0 rows inserted/updated/deleted
+ij(CONN2)> 

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/autoincrement.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/autoincrement.sql?rev=170097&r1=170096&r2=170097&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/autoincrement.sql
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/autoincrement.sql
Fri May 13 14:41:17 2005
@@ -691,3 +691,35 @@
 drop table t1;
 drop table t2;
 drop table t3;
+
+-- test IDENTITY_VAL_LOCAL function with 2 different connections
+-- connection one
+connect 'wombat' as conn1;
+create table t1 (c11 int generated always as identity (start with 101, increment by 3), c12
int);
+create table t2 (c21 int generated always as identity (start with 201, increment by 5), c22
int);
+-- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into table with identity
column yet on this connection conn1
+values IDENTITY_VAL_LOCAL();
+commit;
+-- connection two
+connect 'wombat' as conn2;
+-- IDENTITY_VAL_LOCAL() will return NULL because no single row insert into table with identity
column yet on this connection conn2
+values IDENTITY_VAL_LOCAL();
+insert into t2 (c22) values (1);
+-- IDENTITY_VAL_LOCAL() will return 201 because there was single row insert into table t2
with identity column on this connection conn2
+values IDENTITY_VAL_LOCAL();
+set connection conn1;
+-- IDENTITY_VAL_LOCAL() will continue to return NULL because no single row insert into table
with identity column yet on this connection conn1
+values IDENTITY_VAL_LOCAL();
+insert into t1 (c12) values (1);
+-- IDENTITY_VAL_LOCAL() will return 101 because there was single row insert into table t1
with identity column on this connection conn1
+values IDENTITY_VAL_LOCAL();
+set connection conn2;
+-- IDENTITY_VAL_LOCAL() on conn2 not impacted by single row insert into table with identity
column on conn1
+values IDENTITY_VAL_LOCAL();
+-- notice that committing the transaction does not affect IDENTITY_VAL_LOCAL()
+commit;
+values IDENTITY_VAL_LOCAL();
+drop table t1;
+drop table t2;
+
+



Mime
View raw message