                                         :result-set-fn vec)))
 
 (defn get-tables
+
   "Get tables from given JDBC URL
 
   (get-tables \"postgresql://localhost:5432/northwind?user=myuser&password=secret\""

    (jdbc/get-connection url)
    (catch Exception e (warn e))))

(defn build-select "Build a SELECT query" [url tables query]
  (def fro (map keyword (set (string/split tables #" "))))
  (def sele (vec (map keyword (set (string/split query #" ")))))
  (jdbc/query url (sql/format (sql/build :select sele
                         :from fro)) :result-set-fn vec))

(defn exec-query "Execute a query against the data base" [url query-map]
  (jdbc/query (sql/format query-map) :result-set-fn vec))

  (:use [taoensso.timbre :only [trace debug info warn error fatal]]
        [clojure.walk]))

;; TODO USe keywords and maps to get rid of cond and such
(def db-list [:postgresql :mysql :oracle :mssql])

(defn tables-sqlmap

  "Returns database specific map, takes dbms and database parameters.

  (tables-sql \"postgresql\" \"northwind\")"
