|
| 1 | +#coding:utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | +ID: issue-8056 |
| 5 | +ISSUE: https://github.com/FirebirdSQL/firebird/issues/8056#issuecomment-2032627160 |
| 6 | +TITLE: "Too many temporary blobs" - additional test for issuecomment-2032627160 |
| 7 | +DESCRIPTION: |
| 8 | +NOTES: |
| 9 | + Confirmed bug on 5.0.1.1373 #48915d1 (commit timestamp: 02-apr-2024 14:14 UTC). |
| 10 | + Checked on 5.0.1.1377 #3b5ab26 (commit timestamp: 03-apr-2024 20:59 UTC) - all OK. |
| 11 | +""" |
| 12 | + |
| 13 | +import pytest |
| 14 | +from firebird.qa import * |
| 15 | + |
| 16 | +db = db_factory() |
| 17 | + |
| 18 | +test_script = """ |
| 19 | + set blob all; |
| 20 | + set count on; |
| 21 | + set list on; |
| 22 | + set bail on; |
| 23 | + set term ^; |
| 24 | + execute block returns (vb varchar(20)) |
| 25 | + as |
| 26 | + declare b blob; |
| 27 | + declare bhandle integer; |
| 28 | + declare read_data varbinary(20); |
| 29 | + begin |
| 30 | + -- Create a BLOB handle in the temporary space. |
| 31 | + b = rdb$blob_util.new_blob(true, true); |
| 32 | +
|
| 33 | + -- Add chunks of data. |
| 34 | + b = blob_append(b, '1'); |
| 35 | + b = blob_append(b, '2345'); |
| 36 | + b = blob_append(b, '67'); |
| 37 | + b = blob_append(b, '8'); |
| 38 | +
|
| 39 | + if (rdb$blob_util.is_writable(b)) then |
| 40 | + begin |
| 41 | + vb = ''; |
| 42 | + bhandle = rdb$blob_util.open_blob(b); |
| 43 | +
|
| 44 | + while (true) |
| 45 | + do |
| 46 | + begin |
| 47 | + read_data = rdb$blob_util.read_data(bhandle, null); |
| 48 | + if (read_data is null) then |
| 49 | + break; |
| 50 | +
|
| 51 | + vb = vb || read_data || '-'; |
| 52 | + end |
| 53 | +
|
| 54 | + execute procedure rdb$blob_util.close_handle(bhandle); |
| 55 | +
|
| 56 | + suspend; |
| 57 | + end |
| 58 | + end |
| 59 | + ^ |
| 60 | + set term ;^ |
| 61 | +""" |
| 62 | + |
| 63 | +act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')]) |
| 64 | + |
| 65 | +expected_stdout = """ |
| 66 | + VB 1-2345-67-8- |
| 67 | + Records affected: 1 |
| 68 | +""" |
| 69 | + |
| 70 | +@pytest.mark.version('>=5.0.1') |
| 71 | +def test_1(act: Action): |
| 72 | + act.expected_stdout = expected_stdout |
| 73 | + act.execute(combine_output = True) |
| 74 | + assert act.clean_stdout == act.clean_expected_stdout |
0 commit comments