From 4d69593b6038d3df035aae0bd278103a56ec6500 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 1 Jul 2013 08:15:56 +1000 Subject: A bit more readme changing --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f141494..360a16d 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,17 @@ Thus: `(and (= :name "Barry") (= (length :username) 10))` compiles into an SQL expression equivalent to `("name" = 'Barry' AND "length"("username") = 10)`. -A few more involved query examples: +A few more query examples: (require '[clojure-sql.core :as s]) + ;; this is only shown as a demonstration + ;; a query like this is not advised for general use + (s/table :users) + ;; => ["SELECT * FROM \"users\" AS \"users1715\""] + + ;; it is recommended that a query be projected first to provide + ;; clojure-sql with field information (-> (s/table :users) ;; tables are automatically given internal aliases (s/project [:id :username])) ;; => ["SELECT \"users3205\".\"id\" AS \"id\", \"users3205\".\"username\" AS \"username\" FROM \"users\" AS \"users3205\""] -- cgit v1.2.3