(ns metabase.driver.sql-jdbc.quoting (:require [honey.sql :as sql] [metabase.driver.sql.query-processor :as sql.qp])) | |
Helper macro for quoting identifiers. | (defmacro with-quoting [driver & body] `(binding [sql/*dialect* (sql/get-dialect (sql.qp/quote-style ~driver)) sql/*quoted* true] ~@body)) |
Protect against a table being interpreted as a function call. | (defn quote-table [table-name] (keyword (str "'" (sql/format-entity (keyword table-name))))) |
Quote an identifier, in case it looks like a function call. | (defn quote-identifier [ref] [:raw (sql/format-entity ref)]) |
Used to quote column names when building HoneySQL queries, in case they look like function calls. | (defn quote-columns [driver columns] (with-quoting driver (map quote-identifier columns))) |