Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bin): fix newline handling for --format/override #128

Merged
merged 2 commits into from
Dec 10, 2022

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Dec 10, 2022

#127 introduced Record::Newline. We don't need to insert newlines between records, and we can preserve newlines.

outfile: &mut File,
) -> std::io::Result<()> {
// check whether outfile ends with multiple newlines, which happens if
// - the last record is statement/query
Copy link
Member Author

Choose a reason for hiding this comment

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

cc @alamb This is an egde case we need to consider after adding \n to Display of statement and query. 😇

We need to consider it if we want file to end with newline. i.e., like

for record in records {
    println!("{record}");
}

In the roundtrip parsing test, it uses join

@xxchan xxchan merged commit f07a73e into main Dec 10, 2022
@xxchan xxchan deleted the xxchan/breakable-mite branch December 10, 2022 21:39
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