Skip to content

Commit

Permalink
adapt for new versions of clojure, clojureql & incanter
Browse files Browse the repository at this point in the history
  • Loading branch information
alexott committed Dec 15, 2012
1 parent 5fe3359 commit a952686
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
11 changes: 6 additions & 5 deletions modules/incanter-sql/project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(defproject incanter-sql "1.2.3"
(defproject incanter-sql "1.4.1"
:description "Database interaction via ClojureQL"
:dependencies [[incanter/incanter-core "1.2.3"]
[org.clojure/clojure "1.2.1"]
[clojureql "1.1.0-SNAPSHOT"]]
:dev-dependencies [[org.apache.derby/derby "10.8.1.2"]])
:dependencies [[incanter/incanter-core "1.4.1"]
[clojureql "1.0.4"]
]
:profiles {:dev {:dependencies [[org.apache.derby/derby "10.8.1.2"]]}}
)
13 changes: 6 additions & 7 deletions modules/incanter-sql/src/incanter/sql.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
(ns
^ {:doc "SQL module for interacting with databases."}
incanter.sql
(:use
[incanter.core :only [dataset]]
clojure.contrib.sql
[clojureql.core :as ql :exclude [conj! disj! distinct]]))
(ns incanter.sql
"SQL module for interacting with databases."
(:use [incanter.core :only [dataset]]
[clojureql.core :as ql :exclude [conj! disj! take drop distinct case compile sort]])
(:require [clojure.java.jdbc :as jdbc])
)

(defn window [psize wsize]
(let [full-chunks (quot psize wsize)
Expand Down
13 changes: 7 additions & 6 deletions modules/incanter-sql/test/incanter/sql_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
incanter.sql
incanter.core
clojure.core
clojure.contrib.sql
[clojure.java.jdbc :exclude [resultset-seq]]
[clojureql.core :as q :exclude [conj! disj! take drop distinct case compile sort]]
))
)
)

;;HACK: Jack into the clojureql namespace to override the syntax of
;;the commands that are written.
Expand Down Expand Up @@ -192,7 +193,7 @@ verify the lazy fetching."
(let [dset (read-dataset (q/table :TAB1))]
(is (dataset? dset))
(is (= [:my_id] (:column-names dset)))
(is (= 3 (:my_id (first (:rows dset))))))))
(is (= 3M (:my_id (first (:rows dset))))))))

(deftest test-db-data-types
(wrap-db-test
Expand Down Expand Up @@ -269,16 +270,16 @@ verify the lazy fetching."
(is (dataset? ret))
(let [retrows (:rows ret)]
;; Check the first row looks OK...
(is (= 1 (:a (first retrows))))
(is (= {:a 20 :b "X120"} (nth retrows 19)))
(is (== 1 (:a (first retrows))))
(is (= {:a 20M :b "X120"} (nth retrows 19)))

;; Confirm the query count:
;; It's not 2, because we wanted to get the population
;; count before.
(is (= 3 (count @clojureql.core/statements-made)))

;; Now let's get something further out in the list
(is (= {:a 65 :b "X165"} (nth retrows 64)))
(is (= {:a 65M :b "X165"} (nth retrows 64)))
;; And check again
(is (= 6 (count @clojureql.core/statements-made)))

Expand Down

0 comments on commit a952686

Please sign in to comment.