Skip to content

Conversation

@sofiane-soufi
Copy link
Contributor

Implementation:

  • Add a QueryParams API (GetParams, SetParam, SetParams) to query.h.
  • Implement parameter serialization in the client protocol after query text, using quoted string encoding and null representation.
  • Add wire format helpers for quoted strings and null parameter payloads.
  • Bump protocol revision to 54459 and send the addendum section after the Hello handshake to avoid protocol desync.
  • Preserve existing settings serialization and query flow; params are only sent when the server revision supports them.

Notes/Risks:

  • Protocol revision bump requires addendum; missing it causes “Empty query”/desync.
  • Servers older than 54459 ignore params; fallback logic should still be used on the backend.

inline const char* find_quoted_chars(const char* start, const char* end)
{
static constexpr char quoted_chars[] = {'\0', '\b', '\t', '\n', '\'', '\\'};
const auto first = std::find_first_of(start, end, std::begin(quoted_chars), std::end(quoted_chars));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : const auto * first =

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::find_first_of returns a const char* here, so const auto first = … already deduces the pointer type. I can switch to const char* first if you prefer explicitness, happy to update.

Copy link
Contributor

@chenziliang chenziliang Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please, this is usually we do to make things explicit and easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (first == end) ? nullptr : first;
}

void WireFormat::WriteQuotedString(OutputStream& output, std::string_view value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could have some unit test to cover this function, it will be awesome

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chenziliang chenziliang enabled auto-merge January 22, 2026 17:53
@chenziliang chenziliang merged commit a208480 into timeplus-io:master Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants