Skip to content

[mysql] separate the "columns" lifetime from writer#81

Open
MichaelScofield wants to merge 1 commit into
databendlabs:mainfrom
GreptimeTeam:separate-row-writer-column-lifetime
Open

[mysql] separate the "columns" lifetime from writer#81
MichaelScofield wants to merge 1 commit into
databendlabs:mainfrom
GreptimeTeam:separate-row-writer-column-lifetime

Conversation

@MichaelScofield
Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Make the lifetime of the "columns" field in the struct RowWriter an individual one, instead of being equal to struct RowWriter. In doing so, the following pattern of writing multiple result sets (or affected rows) to the client is made possible without Rust complaining about "variable does not live long enough":

let mut writer: QueryResultWriter = ...
for x in responses {
  let columns = find_columns(x.schema());
  writer = write_mysql_resp(columns, x).await;
}
writer.no_more_results().await;

@MichaelScofield MichaelScofield marked this pull request as draft April 13, 2026 09:18
@MichaelScofield MichaelScofield marked this pull request as ready for review April 13, 2026 13:44
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.

1 participant