Skip to content

Commit

Permalink
update another recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Jan 30, 2025
1 parent c71cae1 commit 0ab2194
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/source/cpp/recipe/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ int main() {
/// ahead of time, so this value will actually just be ``-1`` to
/// indicate that the value is not known.
std::cout << "Got " << rows_affected << " rows" << std::endl;
// Output: Got -1 rows affected

/// We need an Arrow implementation to read the actual results. We
/// can use `Arrow C++`_ or `Nanoarrow`_ for that. For simplicity,
Expand Down Expand Up @@ -195,10 +196,11 @@ int main() {
<< "] = " << view.children[0]->buffer_views[1].data.as_int64[i]
<< std::endl;
}
// Output:
// THEANSWER[0] = 42
ArrowArrayViewReset(&view);
}

std::cout << "Finished reading result set" << std::endl;
stream.release(&stream);

/// Cleanup
Expand Down
8 changes: 7 additions & 1 deletion docs/source/ext/sphinx_recipe/sphinx_recipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ def run(self):
new_fragments = []
for fragment in fragments:
if fragment.kind == "stdout":
stdout.extend(line.content for line in fragment.lines)
lines = fragment.lines
if lines and lines[0].content == "":
# Avoid blank line when using format like
# // Output:
# // theanswer = 42
lines = lines[1:]
stdout.extend(line.content for line in lines)
elif fragment.kind == "stderr":
stderr.extend(line.content for line in fragment.lines)
else:
Expand Down

0 comments on commit 0ab2194

Please sign in to comment.