Back

as-? (clj)

(source)

function

(as-? key-map _)
Given a hash map of column names and values, or a vector of column names, return a string of `?` placeholders for them.

Examples

next-jdbc
(ns next.jdbc.sql.builder-test
  "Tests for the SQL string building functions in next.jdbc.sql.builder."
  (:require [clojure.test :refer [deftest is testing]]
            [next.jdbc.quoted :refer [mysql sql-server]]
            [next.jdbc.sql.builder :as builder]))

(deftest test-as-?
  (is (= (builder/as-? {:a nil :b 42 :c "s"} {})
         "?, ?, ?")))
seancorfield/next-jdbc
(ns next.jdbc.sql.builder-test
  "Tests for the SQL string building functions in next.jdbc.sql.builder."
  (:require [clojure.test :refer [deftest is testing]]
            [next.jdbc.quoted :refer [mysql sql-server]]
            [next.jdbc.sql.builder :as builder]))

(deftest test-as-?
  (is (= (builder/as-? {:a nil :b 42 :c "s"} {})
         "?, ?, ?")))