2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
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
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory(charset='ISO8859_1')
|
2021-11-18 20:15:37 +01:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
act = python_act('db', substitutions=[('.*CREATE DATABASE.*', '')])
|
2021-11-18 20:15:37 +01:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
test_script = """
|
2021-11-18 20:15:37 +01:00
|
|
|
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;
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
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;
|
2021-11-18 20:15:37 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.isql(switches=[], input=test_script, charset='ISO8859_1')
|
|
|
|
act.reset()
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.isql(switches=['-x'])
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
|