Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Lunagariya <[email protected]>
  • Loading branch information
HarshLunagariya committed Dec 12, 2024
1 parent 4e00c8c commit 84bc298
Show file tree
Hide file tree
Showing 2 changed files with 466 additions and 0 deletions.
353 changes: 353 additions & 0 deletions test/JDBC/expected/BABEL-CROSS-DB-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -794,5 +794,358 @@ int


-- tsql
-- Cross-db testcases for statements in batch/block
USE master;
GO

-- Batches having system objects
BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; BEGIN SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; END; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; END; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; BEGIN SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


-- Batches having user created objects
BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; BEGIN SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1; END; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1; END; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; BEGIN SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1; END;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


-- Batches having different types of DMLs
BEGIN; INSERT INTO my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 VALUES (1); BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; END;
GO
~~ROW COUNT: 1~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; BEGIN; INSERT INTO my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 VALUES (1); END; END;
GO
~~START~~
int
1
~~END~~

~~ROW COUNT: 1~~


BEGIN; UPDATE my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 SET a = 2; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; END;
GO
~~ROW COUNT: 10~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; BEGIN; UPDATE my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 SET a = 2; END; END;
GO
~~START~~
int
1
~~END~~

~~ROW COUNT: 10~~


BEGIN; DELETE FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 WHERE a = 2; BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; END; END;
GO
~~ROW COUNT: 10~~

~~START~~
int
1
~~END~~


BEGIN; SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1; BEGIN; DELETE FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 WHERE a = 2; END; END;
GO
~~START~~
int
1
~~END~~


-- Batches with subqueries
SELECT DISTINCT (SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 t2 WHERE t2.a = t1.a) FROM babel_cross_db_vu_prepare_master_t1 t1;
SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
GO
~~START~~
int
<NULL>
~~END~~

~~START~~
int
1
~~END~~


SELECT DISTINCT 1 FROM babel_cross_db_vu_prepare_master_t1;
SELECT DISTINCT (SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.babel_cross_db_vu_prepare_db1_t1 t2 WHERE t2.a = t1.a) FROM babel_cross_db_vu_prepare_master_t1 t1;
GO
~~START~~
int
1
~~END~~

~~START~~
int
<NULL>
~~END~~







-- tsql
-- <IGNORED FOR NOW - File new jira/issue>
-- Batches with DDL and DML combination
-- BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; BEGIN CREATE TABLE babel_cross_db_vu_verify_tempt(a int); SELECT DISTINCT 1 FROM babel_cross_db_vu_verify_tempt; END; END;
-- GO
-- getting corrupted user_id ???
-- SELECT user_id();
-- GO
-- DROP TABLE babel_cross_db_vu_verify_tempt;
-- GO
-- BEGIN; CREATE TABLE babel_cross_db_vu_verify_tempt(a int); SELECT DISTINCT 1 FROM babel_cross_db_vu_verify_tempt; BEGIN; SELECT DISTINCT 1 FROM my_babel_cross_db_vu_prepare_db1.dbo.sysdatabases; END; END;
-- GO
-- DROP TABLE babel_cross_db_vu_verify_tempt;
-- GO
USE master
GO
Loading

0 comments on commit 84bc298

Please sign in to comment.