mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
109 lines
2.6 KiB
Python
109 lines
2.6 KiB
Python
#coding:utf-8
|
|
|
|
"""
|
|
ID: issue-4464
|
|
ISSUE: 4464
|
|
TITLE: Wrong metadata output script generated by isql / CHARACTER SETISO8859_1 syntax error
|
|
DESCRIPTION: NB: missed space in the clause CHARACTER SET<SPACE>ISO8859_1
|
|
JIRA: CORE-4137
|
|
FBTEST: bugs.core_4137
|
|
NOTES:
|
|
[30.09.2023] pzotov
|
|
Procedure text parameters have collate clause in FB 6.x, added splitting.
|
|
"""
|
|
|
|
import pytest
|
|
from firebird.qa import *
|
|
|
|
db = db_factory(charset='ISO8859_1')
|
|
|
|
act = python_act('db', substitutions=[('.*CREATE DATABASE.*', '')])
|
|
|
|
test_script = """
|
|
alter character set iso8859_1 set default collation pt_br;
|
|
commit;
|
|
|
|
set term ^ ;
|
|
create or alter procedure test (
|
|
p01 char(10) character set iso8859_1
|
|
) returns (
|
|
o01 varchar(30) character set iso8859_1
|
|
) as begin
|
|
exit;
|
|
end
|
|
^
|
|
set term ;^
|
|
commit;
|
|
"""
|
|
|
|
expected_stdout_5x = """
|
|
SET SQL DIALECT 3;
|
|
/* Character sets */
|
|
ALTER CHARACTER SET ISO8859_1 SET DEFAULT COLLATION PT_BR;
|
|
COMMIT WORK;
|
|
COMMIT WORK;
|
|
SET AUTODDL OFF;
|
|
SET TERM ^ ;
|
|
/* Stored procedures headers */
|
|
CREATE OR ALTER PROCEDURE TEST (P01 CHAR(10) CHARACTER SET ISO8859_1)
|
|
RETURNS (O01 VARCHAR(30) CHARACTER SET ISO8859_1)
|
|
AS
|
|
BEGIN EXIT; END ^
|
|
SET TERM ; ^
|
|
COMMIT WORK;
|
|
SET AUTODDL ON;
|
|
COMMIT WORK;
|
|
SET AUTODDL OFF;
|
|
SET TERM ^ ;
|
|
/* Stored procedures bodies */
|
|
ALTER PROCEDURE TEST (P01 CHAR(10) CHARACTER SET ISO8859_1)
|
|
RETURNS (O01 VARCHAR(30) CHARACTER SET ISO8859_1)
|
|
AS
|
|
begin
|
|
exit;
|
|
end ^
|
|
SET TERM ; ^
|
|
COMMIT WORK;
|
|
SET AUTODDL ON;
|
|
"""
|
|
|
|
expected_stdout_6x = """
|
|
SET SQL DIALECT 3;
|
|
/* Character sets */
|
|
ALTER CHARACTER SET ISO8859_1 SET DEFAULT COLLATION PT_BR;
|
|
COMMIT WORK;
|
|
COMMIT WORK;
|
|
SET AUTODDL OFF;
|
|
SET TERM ^ ;
|
|
/* Stored procedures headers */
|
|
CREATE OR ALTER PROCEDURE TEST (P01 CHAR(10))
|
|
RETURNS (O01 VARCHAR(30))
|
|
AS
|
|
BEGIN EXIT; END ^
|
|
SET TERM ; ^
|
|
COMMIT WORK;
|
|
SET AUTODDL ON;
|
|
COMMIT WORK;
|
|
SET AUTODDL OFF;
|
|
SET TERM ^ ;
|
|
/* Stored procedures bodies */
|
|
ALTER PROCEDURE TEST (P01 CHAR(10))
|
|
RETURNS (O01 VARCHAR(30))
|
|
AS
|
|
begin
|
|
exit;
|
|
end ^
|
|
SET TERM ; ^
|
|
COMMIT WORK;
|
|
SET AUTODDL ON;
|
|
"""
|
|
|
|
@pytest.mark.version('>=3.0')
|
|
def test_1(act: Action):
|
|
act.isql(switches=[], input=test_script, charset='ISO8859_1')
|
|
act.reset()
|
|
|
|
act.expected_stdout = expected_stdout_5x if act.is_version('<6') else expected_stdout_6x
|
|
act.isql(switches=['-x'], combine_output = True)
|
|
assert act.clean_stdout == act.clean_expected_stdout
|