module

UPD::Serialization

Constants

CORE_TABLES_ORDER = ["entries", "annotations"]

RFC 5.4.1: Table order for data payload serialization These tables MUST always be serialized in this exact order

Class methods

compute_data_hash(database, dataset_id : String, tables_to_serialize : Array(String), algorithm : String = "SHA256") : String

Compute data hash for a dataset Per RFC Section 5.4 Supports multiple algorithms per RFC Section 9 Appendix A

Source
compute_schema_hash(database, tables : Array(String), algorithm : String = "SHA256") : String

Compute schema hash Per RFC Section 5.5 Supports multiple algorithms per RFC Section 9 Appendix A

Source
get_table_columns(database, table_name : String)

Get table columns from information_schema (robust, handles complex CREATE statements) Per RFC 5.4.3: Columns must be in ordinal_position order

Source
get_where_clause(table_name : String, dataset_id : String) : Tuple(String, Array(String))

Get WHERE clause for filtering table by dataset Per RFC 5.4.1 Returns tuple of {clause, params} for safe parameterized queries

Source
normalize_sql(sql_statement : String) : String

Normalize SQL statement (remove comments, collapse whitespace)

Source
normalized_query_columns(columns)

Canonical data type serialization per RFC Section 5.4.4

Source
read_column(column, row)

Read a column value and convert to canonical string representation

Source
serialize_table(database, table_name : String, dataset_id : String, digest : Digest) : Nil

Serialize a single table for a dataset Returns the canonical byte stream per RFC Section 5.4

Source
validate_table_name(table_name : String)

Validate table name to prevent SQL injection Table names must only contain alphanumeric characters and underscores

Source