Skip to content

NULL and empty string are indistinguishable, and empty values are skipped on hydrate #20

@jkalias

Description

@jkalias

Problem

FetchRecordsQuery::GetColumnValue (src/queries.cc) returns L"" for both SQLITE_NULL and an empty TEXT value. FetchRecordsQuery::Hydrate then does:

if (content.empty()) {
    continue;   // leaves the member at its default-constructed value
}

Impact

  • A column that is SQL NULL and a column that holds an empty string are treated identically.
  • Any empty/NULL value is silently dropped — the corresponding member keeps its default value rather than being explicitly set, so the model cannot reflect what is actually stored.

This conflation also blocks a clean implementation of nullable fields (#2), which needs to distinguish "absent" from "empty/zero".

Suggested direction

Detect SQLITE_NULL explicitly (sqlite3_column_type) and represent it distinctly from an empty value; stop skipping empty content so an empty string is faithfully assigned. Coordinate with the nullable-fields work in #2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions