Skip to content

Commit

Permalink
Merge pull request #521 from duckdb/f-split-msg
Browse files Browse the repository at this point in the history
feat: Catch and add query context for statement extraction
  • Loading branch information
krlmlr authored Oct 26, 2024
2 parents 007c6e4 + 200cba4 commit f486c8c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ static cpp11::list construct_retlist(duckdb::unique_ptr<PreparedStatement> stmt,
cpp11::stop("rapi_prepare: Invalid connection");
}

auto statements = conn->conn->ExtractStatements(query.c_str());
vector<unique_ptr<SQLStatement>> statements;
try {
statements = conn->conn->ExtractStatements(query.c_str());
} catch (std::exception &ex) {
ErrorData error(ex);
error.AddErrorLocation(query);
cpp11::stop("rapi_prepare: Failed to extract statements:\n%s", error.Message().c_str());
}
if (statements.empty()) {
// no statements to execute
cpp11::stop("rapi_prepare: No statements to execute");
Expand Down

0 comments on commit f486c8c

Please sign in to comment.