2021-04-26 20:07:00 +02:00
|
|
|
|
#coding:utf-8
|
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
"""
|
|
|
|
|
ID: issue-5961
|
|
|
|
|
ISSUE: 5961
|
|
|
|
|
TITLE: Position function does not consider the collation for blob
|
|
|
|
|
DESCRIPTION:
|
|
|
|
|
JIRA: CORE-5695
|
2022-02-02 15:46:19 +01:00
|
|
|
|
FBTEST: bugs.core_5695
|
2022-01-25 22:55:48 +01:00
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
import pytest
|
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
test_script = """
|
2021-12-19 22:25:36 +01:00
|
|
|
|
set list on;
|
2021-04-26 20:07:00 +02:00
|
|
|
|
set blob all;
|
|
|
|
|
set term ^;
|
|
|
|
|
execute block returns (res smallint) as
|
|
|
|
|
declare blb blob sub_type 1 segment size 80 collate unicode_ci;
|
|
|
|
|
declare txt varchar(255) collate unicode_ci;
|
|
|
|
|
begin
|
|
|
|
|
-- pure ASCII strings:
|
|
|
|
|
blb = 'A';
|
|
|
|
|
txt = 'a';
|
|
|
|
|
res = position(txt, blb);
|
|
|
|
|
suspend;
|
|
|
|
|
-- strings with NON-ascii characters:
|
|
|
|
|
blb= 'ŁÁTÉÇØΙΚΌΛΑΟΣ';
|
|
|
|
|
txt = 'Łátéçøικόλαος';
|
|
|
|
|
res = position(txt, blb);
|
|
|
|
|
suspend;
|
|
|
|
|
end
|
|
|
|
|
^
|
2021-12-19 22:25:36 +01:00
|
|
|
|
set term ;^
|
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
|
RES 1
|
2021-12-19 22:25:36 +01:00
|
|
|
|
RES 1
|
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
2024-10-31 11:17:14 +01:00
|
|
|
|
@pytest.mark.intl
|
2021-04-26 20:07:00 +02:00
|
|
|
|
@pytest.mark.version('>=3.0.3')
|
2022-01-25 22:55:48 +01:00
|
|
|
|
def test_1(act: Action):
|
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
|
act.execute(charset='utf8')
|
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|