Skip to content

Commit

Permalink
Merge pull request #20 from ur1katz/skip_dynamic_length_null_values
Browse files Browse the repository at this point in the history
Skip null values in dyncamic length fields
  • Loading branch information
ur1katz authored May 24, 2023
2 parents b1987bd + 2cba323 commit f573e6f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions access_parser/access_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _parse_row(self, record):
if not metadata:
return
if metadata.variable_length_field_offsets:
self._parse_dynamic_length_data(original_record, metadata, relative_records_column_map)
self._parse_dynamic_length_data(original_record, metadata, relative_records_column_map, null_table)

def _parse_fixed_length_data(self, original_record, column, null_table):
"""
Expand Down Expand Up @@ -383,18 +383,28 @@ def _parse_dynamic_length_records_metadata(self, reverse_record, original_record
return relative_record_metadata

def _parse_dynamic_length_data(self, original_record, relative_record_metadata,
relative_records_column_map):
relative_records_column_map, null_table):
"""
Parse dynamic (non fixed length) records from row
:param original_record: full unmodified record
:param relative_record_metadata: parsed record metadata
:param relative_records_column_map: relative records colum mapping {index: column}
:param null_table: list indicating which columns have null value
"""
relative_offsets = relative_record_metadata.variable_length_field_offsets
jump_table_addition = 0
for i, column_index in enumerate(relative_records_column_map):
column = relative_records_column_map[column_index]
col_name = column.col_name_str
has_value = True
if column.column_id > len(null_table):
logging.warning("Invalid null table. null values may be shown in the db.")
else:
has_value = null_table[column.column_id]
if not has_value:
self.parsed_table[col_name].append(None)
continue

if self.version == 3:
if i in relative_record_metadata.variable_length_jump_table:
jump_table_addition += 0x100
Expand Down

0 comments on commit f573e6f

Please sign in to comment.