|
16 | 16 | Only one line with statistics is taken in account for one DDL (because their quantity can differ between FB versions). |
17 | 17 | Concrete values of NR, IR, Inserts are ignored because they can change, so each line from statistics looks just like |
18 | 18 | short prefix: 'RDB' (in expected output). |
19 | | -
|
20 | 19 | NOTES: |
21 | 20 | [24.02.2023] pzotov |
22 | | - Checked on 5.0.0.958, 4.0.3.2903 -- all fine. |
| 21 | + Checked on 5.0.0.958, 4.0.3.2903 -- all fine. |
| 22 | + [13.07.2025] pzotov |
| 23 | + Adjusted patterns: one need to take in account SCHEMA prefix that presents for each table |
| 24 | + in the trace (since 6.0.0.834), e.g.: |
| 25 | + Table Natural Index |
| 26 | + **************************************************** |
| 27 | + "SYSTEM"."RDB$DATABASE" 10 |
| 28 | + "SYSTEM"."RDB$RELATIONS" 10 |
| 29 | + "SYSTEM"."RDB$SCHEMAS" 20 10 |
| 30 | + See 'p_rdb_table_with_stat'. |
| 31 | + Checked on 6.0.0.970; 5.0.3.1683; 4.0.6.3221 |
23 | 32 | """ |
24 | 33 |
|
25 | 34 | import locale |
|
114 | 123 |
|
115 | 124 | db = db_factory() |
116 | 125 |
|
117 | | -act = python_act('db', substitutions = [(r'RDB\$\S+\s+\d+(\s+\d+)*', 'RDB')]) |
| 126 | +act = python_act('db', substitutions = [('[ \t]+', ' '), (r'("SYSTEM"\.)?(")?RDB\$\S+\s+\d+(\s+\d+)*', 'RDB'), (r'RDB\$\S+\s+\d+(\s+\d+)*', 'RDB')]) |
118 | 127 |
|
119 | 128 | expected_stdout_trace = """ |
120 | 129 | SET TRANSACTION |
@@ -286,24 +295,25 @@ def test_1(act: Action, capsys): |
286 | 295 | with act.trace(db_events = trace_cfg_items, encoding=locale.getpreferredencoding()): |
287 | 296 | act.isql(input = test_sql, combine_output = True) |
288 | 297 |
|
| 298 | + p_rdb_table_with_stat = re.compile( r'^("SYSTEM"\.)?(")?RDB\$\S+\s+\d+(\s+\d+)*' ) |
| 299 | + |
289 | 300 | allowed_patterns = \ |
290 | 301 | ( |
291 | 302 | '(SET TRANSACTION)' |
292 | 303 | ,'DDL_(BEG|END)' |
293 | 304 | ,'0 records fetched' |
294 | 305 | ,r'\s+\d+\s+ms(,)?' |
295 | 306 | ,r'Table\s+Natural\s+Index\s+Update\s+Insert\s+Delete\s+Backout\s+Purge\s+Expunge' |
296 | | - ,r'^RDB\$\S+\s+\d+' |
| 307 | + ,p_rdb_table_with_stat.pattern # r'^("SYSTEM"\.)?(")?RDB\$\S+\s+\d+' |
297 | 308 | ,'^commit$' |
298 | 309 | ) |
299 | 310 | allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ] |
300 | 311 |
|
301 | 312 | rdb_tables_found_for_this_ddl = False |
302 | 313 | for line in act.trace_log: |
303 | 314 | if line.strip(): |
304 | | - #print(line.strip()) |
305 | 315 | if act.match_any(line.strip(), allowed_patterns): |
306 | | - if line.startswith('RDB$'): |
| 316 | + if p_rdb_table_with_stat.search(line): |
307 | 317 | if not rdb_tables_found_for_this_ddl: |
308 | 318 | print(line.strip()) |
309 | 319 | rdb_tables_found_for_this_ddl = True |
|
0 commit comments