Skip to content

Commit

Permalink
add ALTER as sql statment, that is not returning anything (yihui#2330)
Browse files Browse the repository at this point in the history
add ALTER as sql statment, that is not returning anything, so dbfetch shouldn't be used
  • Loading branch information
maxschmi authored Mar 4, 2024
1 parent ad47ce5 commit 031e08c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

- Fixed broken vignettes, improved CSS for HTML vignettes, and reduced the file sizes.

- SQL code chunks that run `ALTER` statements are only executed and not tried to fecth a result (thanks, @maxschmi, #2330).

# CHANGES IN knitr VERSION 1.45

## NEW FEATURES
Expand Down
2 changes: 1 addition & 1 deletion R/engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ is_sql_update_query = function(query) {
query = gsub('^\\s*--.*\n', '', query)
# remove multi-line comments
if (grepl('^\\s*\\/\\*.*', query)) query = gsub('.*\\*\\/', '', query)
grepl('^\\s*(INSERT|UPDATE|DELETE|CREATE|DROP).*', query, ignore.case = TRUE)
grepl('^\\s*(INSERT|UPDATE|DELETE|CREATE|DROP|ALTER).*', query, ignore.case = TRUE)
}

# sql engine
Expand Down

0 comments on commit 031e08c

Please sign in to comment.