Skip to content

QueryPredicate silently produces malformed SQL when no member matches #22

@jkalias

Description

@jkalias

Problem

In the QueryPredicate constructor (include/query_predicates.h), the member is located by scanning record.member_metadata for an entry whose offset matches the offset derived from the pointer-to-member:

for (auto i = 0; i < record.member_metadata.size(); ++i) {
    if (record.member_metadata[i].offset == offset) {
        member_name_ = record.member_metadata[i].name;
        value_ = ...;
        break;
    }
}

If no entry matches (e.g. an unregistered type — see related issue — or an offset-derivation problem), member_name_ stays empty and no error is raised.

Impact

Evaluate() then emits a clause like = ? (empty column name), producing malformed SQL that fails later at prepare time with a confusing message, rather than failing fast at the point of misuse.

Suggested direction

Throw a clear exception from the constructor when no member matches the pointer-to-member, naming the record type, so the error is reported at construction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions