Function rewriteWhereToOdataFilter

  • Query.where is documented as SQL-92 / CQL2 on the canonical surface. The OData $filter grammar is close to but not identical to SQL-92; this minimal rewriter handles the cases that would otherwise produce a server-side parse error rather than a translated query. Full SQL→OData translation is tracked as follow-up work in docs/decisions/odata-library-selection.md.

    Rewrites applied:

    • IS NULL / IS NOT NULLeq null / ne null
    • <col> = '...', <col> = N<col> eq '...' / <col> eq N
    • SQL-style <>ne
    • SQL comparison operators >= / <= / > / <ge / le / gt / lt (Honua Server's OData lexer rejects bare punctuation comparisons as InvalidQueryOption).

    Predicates whose syntax already matches OData (e.g. STATE eq 'CA') pass through unchanged. Unsupported operators (HAS, IN, ANY, ALL, CAST, ISOF from the parity matrix) are detected and rejected with a typed error rather than left to the server.

    Parameters

    • where: string

    Returns string