File: summary_DBIObject.R

package info (click to toggle)
dbi 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,740 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 424 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#' @usage NULL
summary_DBIObject <- function(object, ...) {
  info <- dbGetInfo(dbObj = object, ...)
  cat(class(object), "\n")
  print_list_pairs(info)
  invisible(info)
}

setMethod("summary", "DBIObject", summary_DBIObject)

print_list_pairs <- function(x, ...) {
  for (key in names(x)) {
    value <- format(x[[key]])
    if (identical(value, "")) {
      next
    }
    cat(key, "=", value, "\n")
  }
  invisible(x)
}