Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
Sandeep Kumawat committed Dec 28, 2023
1 parent b4d581c commit 07d515e
Show file tree
Hide file tree
Showing 9 changed files with 444 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contrib/babelfishpg_tsql/sql/sys_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,12 @@ SELECT
, CAST(0 AS INT) AS principal_id
, CAST(sch.schema_id AS INT) AS schema_id
, CAST(c.conrelid AS INT) AS parent_object_id
, CASE contype
, CAST(
(CASE contype
WHEN 'p' THEN CAST('PK' as sys.bpchar(2))
WHEN 'u' THEN CAST('UQ' as sys.bpchar(2))
END AS type
END)
AS sys.bpchar(2)) AS type
, CAST(
(CASE contype
WHEN 'p' THEN 'PRIMARY_KEY_CONSTRAINT'
Expand Down
50 changes: 50 additions & 0 deletions test/JDBC/expected/BABEL-4529-vu-cleanup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
DROP PROCEDURE IF EXISTS babel_4529_stats
GO

DROP PROCEDURE IF EXISTS babel_4529_dm_exec_connections
GO

DROP PROCEDURE IF EXISTS babel_4529_syscolumns
GO

DROP PROCEDURE IF EXISTS babel_4529_system_objects
GO

DROP PROCEDURE IF EXISTS babel_4529_xml_indexes
GO

DROP PROCEDURE IF EXISTS babel_4529_sysforeignkeys
GO

DROP PROCEDURE IF EXISTS babel_4529_data_spaces
GO

DROP PROCEDURE IF EXISTS babel_4529_sysprocesses
GO

DROP PROCEDURE IF EXISTS babel_4529_key_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_foreign_keys
GO

DROP PROCEDURE IF EXISTS babel_4529_sysviews
GO

DROP PROCEDURE IF EXISTS babel_4529_systables
GO

DROP PROCEDURE IF EXISTS babel_4529_default_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_check_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_types
GO

DROP PROCEDURE IF EXISTS babel_4529_sp_sproc_columns_view
GO

DROP PROCEDURE IF EXISTS babel_4529_systypes
GO
84 changes: 84 additions & 0 deletions test/JDBC/expected/BABEL-4529-vu-prepare.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
CREATE PROCEDURE babel_4529_stats
AS
SELECT stats_generation_method_desc FROM sys.stats
GO

CREATE PROCEDURE babel_4529_dm_exec_connections
AS
SELECT local_net_address, client_net_address, endpoint_id FROM sys.dm_exec_connections where session_id = @@SPID
GO

CREATE PROCEDURE babel_4529_syscolumns
AS
SELECT printfmt FROM sys.syscolumns where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_system_objects
AS
SELECT * FROM sys.system_objects where name='test_key_constraints'
GO

CREATE PROCEDURE babel_4529_xml_indexes
AS
SELECT secondary_type FROM sys.xml_indexes
GO

CREATE PROCEDURE babel_4529_sysforeignkeys
AS
SELECT * FROM sys.sysforeignkeys where fkeyid IS NULL
GO

CREATE PROCEDURE babel_4529_data_spaces
AS
SELECT type FROM sys.data_spaces where type='FG'
GO

CREATE PROCEDURE babel_4529_sysprocesses
AS
SELECT * FROM sys.sysprocesses WHERE loginname = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_key_constraints
AS
SELECT * FROM sys.key_constraints where parent_object_id IS NULL
GO

CREATE PROCEDURE babel_4529_foreign_keys
AS
SELECT * FROM sys.foreign_keys where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_sysviews
AS
SELECT * FROM sys.views where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_systables
AS
SELECT * FROM sys.tables where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_default_constraints
AS
SELECT * FROM sys.default_constraints where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_check_constraints
AS
SELECT * FROM sys.check_constraints where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_types
AS
SELECT * FROM sys.types where name = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_sp_sproc_columns_view
AS
SELECT * FROM sys.sp_sproc_columns_view where PROCEDURE_QUALIFIER = 'test_name_4529'
GO

CREATE PROCEDURE babel_4529_systypes
AS
SELECT * FROM sys.systypes where name = 'test_name_4529'
GO
120 changes: 120 additions & 0 deletions test/JDBC/expected/BABEL-4529-vu-verify.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
EXEC babel_4529_stats
GO
~~START~~
varchar
~~END~~


EXEC babel_4529_dm_exec_connections
GO
~~START~~
varchar#!#varchar#!#int
<NULL>#!#127.0.0.1#!#4
~~END~~


EXEC babel_4529_syscolumns
GO
~~START~~
varchar
~~END~~


EXEC babel_4529_system_objects
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit
~~END~~


EXEC babel_4529_xml_indexes
GO
~~START~~
char
~~END~~


EXEC babel_4529_sysforeignkeys
GO
~~START~~
int#!#int#!#int#!#smallint#!#smallint#!#smallint
~~END~~


EXEC babel_4529_data_spaces
GO
~~START~~
char
FG
~~END~~


EXEC babel_4529_sysprocesses
GO
~~START~~
int#!#smallint#!#int#!#binary#!#bigint#!#nchar#!#nchar#!#int#!#int#!#int#!#bigint#!#int#!#datetime#!#datetime#!#smallint#!#smallint#!#nchar#!#binary#!#nchar#!#nchar#!#nchar#!#nchar#!#nchar#!#nchar#!#nchar#!#nchar#!#nchar#!#varbinary#!#binary#!#int#!#int#!#int
~~END~~


EXEC babel_4529_key_constraints
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#int#!#bit#!#bit#!#bit#!#bit
~~END~~


EXEC babel_4529_foreign_keys
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#int#!#int#!#bit#!#bit#!#bit#!#tinyint#!#nvarchar#!#tinyint#!#nvarchar#!#bit
~~END~~


EXEC babel_4529_sysviews
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#bit#!#bit#!#bit
~~END~~


EXEC babel_4529_systables
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#int#!#int#!#int#!#bit#!#bit#!#bit#!#bit#!#bit#!#bit#!#bit#!#int#!#bit#!#bit#!#tinyint#!#nvarchar#!#bit#!#tinyint#!#nvarchar#!#bit#!#tinyint#!#nvarchar#!#int#!#bit#!#bit
~~END~~


EXEC babel_4529_default_constraints
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#int#!#nvarchar#!#bit
~~END~~


EXEC babel_4529_check_constraints
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#bit#!#bit#!#bit#!#int#!#nvarchar#!#bit#!#bit
~~END~~


EXEC babel_4529_types
GO
~~START~~
varchar#!#int#!#int#!#int#!#int#!#smallint#!#tinyint#!#tinyint#!#varchar#!#bit#!#bit#!#bit#!#int#!#int#!#bit
~~END~~


EXEC babel_4529_sp_sproc_columns_view
GO
~~START~~
varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint#!#varchar
~~END~~


EXEC babel_4529_systypes
GO
~~START~~
varchar#!#int#!#tinyint#!#smallint#!#smallint#!#tinyint#!#tinyint#!#int#!#int#!#smallint#!#smallint#!#int#!#smallint#!#bit#!#bit#!#int#!#varchar#!#smallint#!#tinyint#!#varchar
~~END~~

50 changes: 50 additions & 0 deletions test/JDBC/input/BABEL-4529-vu-cleanup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
DROP PROCEDURE IF EXISTS babel_4529_stats
GO

DROP PROCEDURE IF EXISTS babel_4529_dm_exec_connections
GO

DROP PROCEDURE IF EXISTS babel_4529_syscolumns
GO

DROP PROCEDURE IF EXISTS babel_4529_system_objects
GO

DROP PROCEDURE IF EXISTS babel_4529_xml_indexes
GO

DROP PROCEDURE IF EXISTS babel_4529_sysforeignkeys
GO

DROP PROCEDURE IF EXISTS babel_4529_data_spaces
GO

DROP PROCEDURE IF EXISTS babel_4529_sysprocesses
GO

DROP PROCEDURE IF EXISTS babel_4529_key_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_foreign_keys
GO

DROP PROCEDURE IF EXISTS babel_4529_sysviews
GO

DROP PROCEDURE IF EXISTS babel_4529_systables
GO

DROP PROCEDURE IF EXISTS babel_4529_default_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_check_constraints
GO

DROP PROCEDURE IF EXISTS babel_4529_types
GO

DROP PROCEDURE IF EXISTS babel_4529_sp_sproc_columns_view
GO

DROP PROCEDURE IF EXISTS babel_4529_systypes
GO
Loading

0 comments on commit 07d515e

Please sign in to comment.