richfitz / storr
Showing 1 of 1 files from the diff.

@@ -593,12 +593,12 @@
Loading
593 593
  ## thing.
594 594
  if (n_namespace == 1) {
595 595
    values <- c(ns_uniq[1L], key_uniq)
596 -
    p <- sprintf(placeholder, seq_along(values))
596 +
    p <- placeholder_expand(placeholder, length(values))
597 597
    where <- sprintf("namespace = %s AND key IN (%s)",
598 598
                     p[[1L]], paste(p[-1L], collapse = ", "))
599 599
  } else if (n_key == 1) {
600 600
    values <- c(key_uniq[1L], ns_uniq)
601 -
    p <- sprintf(placeholder, seq_along(values))
601 +
    p <- placeholder_expand(placeholder, length(values))
602 602
    where <- sprintf("key = %s AND namespace IN (%s)",
603 603
                     p[[1L]], paste(p[-1L], collapse = ", "))
604 604
  } else {
@@ -609,8 +609,7 @@
Loading
609 609
    ## A little abuse of R semantics here to interleave namespaces with values:
610 610
    values <- unlist(rbind(lapply(i, function(j) ns_uniq[[j[[1L]]]]),
611 611
                           lapply(i, function(j) key_uniq[j])))
612 -
613 -
    p <- sprintf(placeholder, seq_along(values))
612 +
    p <- placeholder_expand(placeholder, length(values))
614 613
    p <- unname(split(p, rep(seq_along(len), len + 1)))
615 614
    where <- paste(vcapply(p, function(x)
616 615
      sprintf("namespace = %s AND key IN (%s)",
@@ -625,11 +624,7 @@
Loading
625 624
626 625
627 626
driver_dbi_mhash_prepare <- function(hash, placeholder) {
628 -
  if (grepl("%", placeholder)) {
629 -
    paste(sprintf(placeholder, seq_along(hash)), collapse = ", ")
630 -
  } else {
631 -
    paste(rep(placeholder, length(hash)), collapse = ", ")
632 -
  }
627 +
  paste(placeholder_expand(placeholder, length(hash)), collapse = ", ")
633 628
}
634 629
635 630
@@ -661,11 +656,7 @@
Loading
661 656
662 657
663 658
group_placeholders <- function(placeholder, n, times) {
664 -
  if (grepl("%", placeholder)) {
665 -
    p <- matrix(sprintf(placeholder, seq_len(n * times)), n)
666 -
  } else {
667 -
    p <- matrix(rep(placeholder, n * times), n)
668 -
  }
659 +
  p <- matrix(placeholder_expand(placeholder, n * times), n)
669 660
  paste(sprintf("(%s)", apply(p, 2, paste, collapse = ", ")), collapse = ", ")
670 661
}
671 662
@@ -715,3 +706,12 @@
Loading
715 706
    stop(sprintf("The name of table '%s' may not contain quotes", name))
716 707
  }
717 708
}
709 +
710 +
711 +
placeholder_expand <- function(placeholder, n) {
712 +
  if (grepl("%", placeholder)) {
713 +
    sprintf(placeholder, seq_len(n))
714 +
  } else {
715 +
    rep(placeholder, n)
716 +
  }
717 +
}
Files Coverage
R 100.00%
src/storr.c 100.00%
Project Totals (16 files) 100.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading