always inject error as character into DB

This commit is contained in:
Patrick Schratz 2024-07-25 00:52:16 +02:00
commit af04f7938e
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -13,12 +13,16 @@ store_build_metadata <- function(
package_name, "' AND tag = '", tag, "'"
))
if (is.null(error)) {
error <- NA
}
if (nrow(existing_entries) >= 1 && !force) {
cli::cli_alert("{.fun store_build_metadata}: Build metadata for {.field {.pkg package_name}} {.field {tag}} already exists.")
} else if (nrow(existing_entries) >= 1 && force) {
cli::cli_alert_info("{.fun store_build_metadata}: Force overwriting build metadata for {.pkg {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
DBI::dbExecute(con, sprintf("UPDATE single_builds SET build_timestamp = '%s', error_occurred = %s, error = '%s' WHERE package_name = '%s' and tag = '%s'", format(Sys.time(), "%Y-%m-%d %H:%M:%S"), error_occurred, error, package_name, tag))
DBI::dbExecute(con, "UPDATE single_builds SET build_timestamp = $1, error_occurred = $2, error = $3 WHERE package_name = $4 and tag = $5", params = list(format(Sys.time(), "%Y-%m-%d %H:%M:%S"), error_occurred, error, package_name, tag))
} else if (nrow(existing_entries) == 0) {
cli::cli_alert("{.fun store_build_metadata}: Storing build metadata for {.pkg {package_name}} {.field {tag}}.")
# Create a data frame with the metadata