diff options
author | Carlo Zancanaro <carlo@clearboxsystems.com.au> | 2013-06-23 01:12:36 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@clearboxsystems.com.au> | 2013-06-23 01:12:36 +1000 |
commit | 8a436b230b8357eaed6fc59c6fdbeb86295e12f7 (patch) | |
tree | 111d815840147dbac2f2a46cba77f9804ec02ede | |
parent | 7576e833051267e442a999efecbfee95a63acca9 (diff) |
Fix the README examples.
-rw-r--r-- | README.md | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -28,7 +28,7 @@ queries to be entirely special-cased per database. By default (-> (s/table :users) ;; tables are automatically given internal aliases (s/project [:id :username])) - ; => ["SELECT \"users1234\".\"id\", \"users1234\".\"username\" FROM \"users\" AS \"users1234\""] + ;; => ["SELECT \"users3205\".\"id\" AS \"id\", \"users3205\".\"username\" AS \"username\" FROM \"users\" AS \"users3205\""] (-> (s/table :users) (s/project [:id :username]) @@ -36,11 +36,9 @@ queries to be entirely special-cased per database. By default (s/join (-> (s/table :people) (s/project {:id :pid, :fname :first}) (s/select '(= :first "Henry"))) - '(= :uid :pid)) + :on '(= :uid :pid)) (s/project [:username])) - ; => ["SELECT \"users1234\".\"username\" FROM \"users\" AS \"users1234\" JOIN \"people\" AS \"people1234\" ON (\"users1234\".\"id\" = \"people1234\".\"id\") WHERE (\"people1234\".\"fname\" = ?)" "Henry")] - - + ;; => ["SELECT \"users3430\".\"username\" AS \"username\" FROM (\"users\" AS \"users3430\" INNER JOIN \"people\" AS \"people3432\" ON (\"users3430\".\"id\" = \"people3432\".\"id\")) WHERE (\"people3432\".\"fname\" = ?)" "Henry"] [`clojure.java.jdbc`][3] support is provided, but must be included explicitly. `clojure-sql` does not depend on `clojure.java.jdbc`. @@ -48,11 +46,11 @@ explicitly. `clojure-sql` does not depend on `clojure.java.jdbc`. (require '[clojure-sql.jdbc :as jdbc]) (jdbc/use-jdbc! "postgres://user:pass@localhost:5432/db") - ; => nil + ;; => nil (deref (-> (s/table :users) (s/project [:id :username]))) - ; => [{:id 5, :username "mange"}] + ;; => [{:id 5, :username "mange"}] Results are returned from queries in an eager vector. |