⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 declareglobaltemptablejava.out

📁 derby database source code.good for you.
💻 OUT
字号:
Test declaredGlobalTempTableJava startingTEST1 : global temporary tables can only be in SESSION schemaExpected message: The qualifier for a declared global temporary table name must be SESSION.TEST1 PASSEDTEST2A : Declaring a global temporary table while in SYS schema will pass because temp tables always go in SESSION schema and never in default schemaTEST2A PASSEDTEST2B : Drop the declared global temporary table declared in TEST2A while in schema SYSTEST2B PASSEDTEST3A : positive grammar tests for DECLARE commandTEST3A PASSEDTEST3B : negative grammar tests for DECLARE command  Expected exception. Attempted to declare a temp table without NOT LOGGED. Syntax error: Encountered "<EOF>" at line 1, column 42.  Expected exception. Attempted to declare a temp table with multiple NOT LOGGED. Multiple or conflicting keywords involving the 'NOT LOGGED' clause are present.  Expected exception. Attempted to declare a temp table with multiple ON COMMIT. Multiple or conflicting keywords involving the 'ON COMMIT' clause are present.  Expected exception. Attempted to declare a temp table with multiple ON ROLLBACK. Multiple or conflicting keywords involving the 'ON ROLLBACK' clause are present.  Expected exception. Attempted to declare a temp table with syntax error ON ROLLBACK PRESERVE ROWS. Syntax error: Encountered "PRESERVE" at line 1, column 67.  Expected exception. Attempted to declare a temp table without NOT LOGGED. Syntax error: MISSING NOT LOGGED.TEST3B PASSEDTEST4A : ALTER TABLE not allowed on global temporary tablesExpected message: The requested function does not apply to global temporary tables.TEST4A PASSEDTEST4B : ALTER TABLE on physical table in SESSION schema should workTEST4B PASSEDTEST5A : LOCK TABLE not allowed on global temporary tablesExpected message: The requested function does not apply to global temporary tables.TEST5A PASSEDTEST5B : LOCK TABLE on physical table in SESSION schema should workTEST5B PASSEDTEST6A : RENAME TABLE not allowed on global temporary tablesExpected message: The requested function does not apply to global temporary tables.TEST6A PASSEDTEST6B : RENAME TABLE on physical table in SESSION schema should workTEST6B PASSEDTEST6C : RENAME COLUMN on physical table in SESSION schema should workTEST6C PASSEDTEST8 : generated always as identity not supported for declared global temporary tablesExpected message: The requested function does not apply to global temporary tables.TEST8 PASSEDTEST9 : long datatypes not supported for declared global temporary tables  Expected exception. Attempted to declare a temp table with blob. Long column type column or parameter 'C22' not permitted in declared global temporary tables or procedure definitions.   Expected exception. Attempted to declare a temp table with clob. Long column type column or parameter 'C22' not permitted in declared global temporary tables or procedure definitions.   Expected exception. Attempted to declare a temp table with long varchar. Long column type column or parameter 'C22' not permitted in declared global temporary tables or procedure definitions.   Expected exception. Attempted to declare a temp table with user defined type. Syntax error: Encountered "" at line 1, column 56.TEST9 PASSEDTEST10A : Primary key constraint not allowed on a declared global temporary table.Expected message: The requested function does not apply to global temporary tables.TEST10A PASSEDTEST10B : Primary key constraint allowed on a physical table in SESSION schema.TEST10B PASSEDTEST10C : Unique key constraint not allowed on a declared global temporary table.Expected message: The requested function does not apply to global temporary tables.TEST10C PASSEDTEST10D : Foreign key constraint not allowed on a declared global temporary table.Expected message: The requested function does not apply to global temporary tables.TEST10D PASSEDTEST11 : Attempt to declare the same global temporary table twice will fail. Plan to support WITH REPLACE in futureExpected message: Declared global temporary table 'T2' already exists in Schema 'SESSION'.TEST11 PASSEDTEST12 : Try to drop a declared global temporary table that doesn't exist.Expected message: 'DROP TABLE' cannot be performed on 'SESSION.T2' because it does not exist.TEST12 PASSEDTEST13A : insert into declared global temporary table will pass.	 1	 -	{56}TEST13A PASSEDTEST13B : attempt to insert null into non-null column in declared global temporary table will fail.Declare the table with non-null column, insert a row and commitIn the next transaction, attempt to insert a null value in the table will fail and we will loose all the rows from the table as part of internal rollbackExpected message: Column 'C22'  cannot accept a NULL value.should see no data in t2	 C21,C22	 --- ---TEST13B PASSEDTEST13C : declare a temporary table with default and then insert into it.	 C21,C22,C23	 --- --- ---	{1,aa,null}	{2,aa,APP}TEST13C PASSEDTEST14 : Should be able to create Session schema manually.TEST14 PASSEDTEST15 : Session schema can be dropped like any other user-defined schema.TEST15 PASSEDTEST16 : Create a physical SESSION schema, drop it. Next attempt to drop SESSION schema will throw an exception because now we are dealing with in-memory SESSION schema and it can not be dropped by drop schema.In TEST16, now attempting to drop in-memory SESSION schemaExpected message: Schema 'SESSION' does not existTEST16 PASSEDTEST17A : Check constraint not allowed on global temporary tableExpected message: The requested function does not apply to global temporary tables.TEST17A PASSEDTEST17B : Check constraint allowed on physical SESSION schema tableTEST17B PASSEDTEST18 : Test declared temporary table with ON COMMIT DELETE ROWS with and without open cursorsTests with holdable cursor are in a different class since holdability support is only under jdk14 and higherTemp table t2 with not holdable cursor open on it. Data should get deleted from t2 at commit time	 1	 -	{2}Temp table t3 with no open cursors of any kind on it. Data should get deleted from t3 at commit time	 1	 -	{2}After commit, verify the 2 tablesTemp table t2 will have no data after commit	 1	 -	{0}Temp table t3 will have no data after commit	 1	 -	{0}TEST18 PASSEDTEST19 : Declare a temporary table with ON COMMIT PRESERVE ROWS with and without open cursorsTests with holdable cursor are in a different class since holdability support is only under jdk14 and higherTemp table t2 with not holdable cursor open on it. Data should be preserved, holdability shouldn't matter	 1	 -	{2}Temp table t3 with no open cursors of any kind on it. Data should be preserved, holdability shouldn't matter	 1	 -	{2}After commit, verify the 2 tablesTemp table t2 will have data after commit	 1	 -	{2}Temp table t3 will have data after commit	 1	 -	{2}TEST19 PASSEDTEST20A : CREATE INDEX not allowed on global temporary table.Expected message: The requested function does not apply to global temporary tables.TEST20A PASSEDTEST21A : CREATE INDEX on physical table in SESSION schema should workTEST21A PASSEDTEST26A : CREATE VIEW not allowed on global temporary table.Expected message: The requested function can not reference tables in SESSION schema.TEST26A PASSEDTEST27A : CREATE VIEW not allowed on physical table in SESSION schemaExpected message: The requested function can not reference tables in SESSION schema.TEST27A PASSEDTEST28A : CREATE VIEW in SESSION schema referencing a table outside of SESSION schemaSELECT * from SESSION.t28v1 should show contents of view	 C28	 ---	{280}	{281}Now declare a global temporary table with same name as the view in SESSION schemaSELECT * from SESSION.t28v1 should show contents of global temporary table	 C21,C22	 --- ---	{280,1}	{281,2}We have dropped global temporary table hence SESSION.t28v1 should point to view at this point	 C28	 ---	{280}	{281}TEST28A PASSEDTEST29A : DELETE FROM global temporary table allowed.	 1	 -	{2}	 1	 -	{0}TEST29A PASSEDTEST31A : UPDATE on global temporary table allowed.TEST31A PASSEDMultiple tests to make sure we do not do statement caching for statement referencing SESSION schema tablesTEST34A : CREATE physical table and then DECLARE GLOBAL TEMPORARY TABLE with the same name in session schema.	 C21	 ---	{21}	 C21,C22	 --- ---	{22,22}	{23,23}	 C21,C22	 --- ---	{22,22}	{23,23}	 C21	 ---	{21}TEST34A PASSEDTEST34B : Physical table & TEMPORARY TABLE with the same name in session schema, try insert.	 C21	 ---	{21}	 C21	 ---	 C21	 ---	{99}	 C21	 ---	{21}TEST34B PASSEDTEST35A : Temporary table created in one connection should not be available in another connection	 1	 -	{1}Expected message: Table 'SESSION.T2' does not exist.TEST35A PASSEDTEST35B : Temp table in one connection should not conflict with temp table with same name in another connection	 C21,C22	 --- ---	{22,22}	 C21	 ---	{99}	 C21,C22	 --- ---	{22,22}TEST35B PASSEDTEST36 : After creating SESSION schema and making it current schema, temporary tables should not require SESSION qualificationTEST36 PASSEDTEST37A : Prepared statement test - drop the temp table underneath	 C21,C22	 --- ---	{21,1}Expected message: Table 'SESSION.T2' does not exist.TEST37A PASSEDTEST37B : Prepared statement test - drop and recreate the temp table with different definition underneath	 C21,C22	 --- ---	{21,1}Expected message: The number of values assigned is not the same as the number of specified or implied columns.TEST37B PASSEDTEST38A : Rollback behavior - declare temp table, rollback, select should fail	 C21,C22	 --- ---	{21,1}TEST38A : select should fail since temp table got dropped as part of rollbackExpected message: Table 'SESSION.T2' does not exist.TEST38A PASSEDTEST38B : Rollback behavior - declare temp table, commit, drop temp table, rollback, select should pass	 C21,C22	 --- ---	{21,1}	 C21,C22	 --- ---	{21,1}TEST38B : select should pass since temp table drop was rolled back	 C21,C22	 --- ---TEST38B PASSEDTEST38C : Rollback behavior In the transaction:  Declare temp table t2 with 3 columns	 C21,C22,C23	 --- --- ---	{1,1,1}  Drop temp table t2 (with 3 columns)  Attempted to select from temp table t2 but it failed as expected with exception Table 'SESSION.T2' does not exist.  Declare temp table t2 again but this time with 2 columns	 C21,C22	 --- --- Commit the transaction. Should have temp table t2 with 2 columns In the next transaction:	 C21,C22	 --- ---  Drop temp table t2 (with 2 columns)  Declare temp table t2 again but this time with 1 column	 C21	 --- Rollback this transaction. Should have temp table t2 with 2 columns	 C21,C22	 --- ---TEST38C PASSEDTEST38D : Rollback behavior for tables touched with DML In the transaction:  Declare temp table t2 & t3 & t4 & t5 with preserve rows, insert data and commit	 C21,C22	 --- ---	{21,1}	{22,2}	{23,3}	 C31,C32	 --- ---	{31,1}	{32,2}	{33,3}	 C41,C42	 --- ---	{41,1}	{42,2}	{43,3}	 C51,C52	 --- ---	{51,1}	{52,2}	{53,3} In the next transaction:  Declare temp table t6 with preserve rows, insert data and inspect data in all the tables	 C21,C22	 --- ---	{21,1}	{22,2}	{23,3}	 C31,C32	 --- ---	{31,1}	{32,2}	{33,3}	 C41,C42	 --- ---	{41,1}	{42,2}	{43,3}	 C51,C52	 --- ---	{51,1}	{52,2}	{53,3}	 C61,C62	 --- ---	{61,1}	{62,2}	{63,3}  delete from t2 with t5 in it's where clause, look at t2	 C21,C22	 --- ---	{21,1}	{22,2}  delete with where clause from t3 so that no rows get deleted, look at the rows	 C31,C32	 --- ---	{31,1}	{32,2}	{33,3}  do not touch t4  rollback this transaction, should not see any rows in temp table t2 after rollback	 C21,C22	 --- ---  temp table t3 should have no rows because attempt was made to delete from it (even though nothing actually got deleted from it in the transaction)	 C31,C32	 --- ---  temp table t4 should have its data intact because it was not touched in the transaction that got rolled back	 C41,C42	 --- ---	{41,1}	{42,2}	{43,3}  temp table t5 should have its data intact because it was only used in where clause and not touched in the transaction that got rolled back	 C51,C52	 --- ---	{51,1}	{52,2}	{53,3}  temp table t6 got dropped as part of rollback of this transaction since it was declared in this same transaction  Attempted to select from temp table t6 but it failed as expected with exception Table 'SESSION.T6' does not exist.TEST38D PASSEDTEST39A : Verify that there is no entry in system catalogs for temporary tables Declare a temp table T2 and check system catalogs. Shouldn't find anything. Then drop the temp table	 TABLEID,TABLENAME,TABLETYPE,SCHEMAID,LOCKGRANULARITY	 ------- --------- --------- -------- ---------------	 TABLENAME,SCHEMANAME	 --------- ---------- Create physical schema SESSION, create a physical table T2 in SESSION schema and check system catalogs. Should be there	 TABLEID,TABLENAME,TABLETYPE,SCHEMAID,LOCKGRANULARITY	 ------- --------- --------- -------- ---------------	{xxxxFILTERED-UUIDxxxx,T2,T,xxxxFILTERED-UUIDxxxx,R}TEST39A PASSEDTEST39B : Verify that there is no entry in system catalogs for SESSION schmea after declare table Declare a temp table T2 and check system catalogs for SESSION schmea. Shouldn't find anything. Then drop the temp table	 SCHEMANAME	 ----------TEST39B PASSEDTEST40 : DatabaseMetaData.getTables() should not return temporary tablesgetTables() with no types:	 TABLE_CAT,TABLE_SCHEM,TABLE_NAME,TABLE_TYPE,REMARKS	 --------- ----------- ---------- ---------- -------	{,SYS,SYSALIASES,SYSTEM TABLE,}	{,SYS,SYSCHECKS,SYSTEM TABLE,}	{,SYS,SYSCOLUMNS,SYSTEM TABLE,}	{,SYS,SYSCONGLOMERATES,SYSTEM TABLE,}	{,SYS,SYSCONSTRAINTS,SYSTEM TABLE,}	{,SYS,SYSDEPENDS,SYSTEM TABLE,}	{,SYS,SYSFILES,SYSTEM TABLE,}	{,SYS,SYSFOREIGNKEYS,SYSTEM TABLE,}	{,SYS,SYSKEYS,SYSTEM TABLE,}	{,SYS,SYSSCHEMAS,SYSTEM TABLE,}	{,SYS,SYSSTATEMENTS,SYSTEM TABLE,}	{,SYS,SYSSTATISTICS,SYSTEM TABLE,}	{,SYS,SYSTABLES,SYSTEM TABLE,}	{,SYS,SYSTRIGGERS,SYSTEM TABLE,}	{,SYS,SYSVIEWS,SYSTEM TABLE,}	{,SYSIBM,SYSDUMMY1,SYSTEM TABLE,}	{,SESSION,T3,TABLE,}TEST40 PASSEDTEST41 : delete where current of on temporary tables	 C21,C22	 --- ---	{21,1}	{22,1}	 C21,C22	 --- ---	{22,1}	 C21,C22	 --- ---TEST41 PASSEDTEST42 : update where current of on temporary tables	 C21,C22	 --- ---	{21,1}	{22,1}	 C21,C22	 --- ---	{21,2}	{22,1}	 C21,C22	 --- ---	{21,2}	{22,2}TEST42 PASSEDTEST44A : Prepared statement test - DML and rollback behavior In the transaction:  Declare temp table t2, insert data using prepared statement and commit	 C21,C22	 --- ---	{21,1} In the next transaction:  insert more data using same prepared statement and rollback. Should loose all the data in t2	 C21,C22	 --- ---TEST44A PASSEDTEST44B : Prepared statement test - DML and rollback behavior In the transaction:  Declare temp table t2, insert data and commit	 C21,C22	 --- ---	{21,1} In the next transaction:  prepare a statement for insert into table but do not execute it and rollback  Should not loose the data from t2	 C21,C22	 --- ---	{21,1}TEST44B PASSEDPASSTest declaredGlobalTempTable finished

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -