Created
March 1, 2012 06:20
-
-
Save xeqi/1947746 to your computer and use it in GitHub Desktop.
clojure.java.jdbc, sqlite3, transactions, and resultsets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ TEST_DBS=sqlite mvn clojure:test | |
[INFO] Scanning for projects... | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Building java.jdbc | |
[INFO] task-segment: [clojure:test] | |
[INFO] ------------------------------------------------------------------------ | |
Downloading: http://repo1.maven.org/maven2/net/sourceforge/jtds/jtds/1.2.4/jtds-1.2.4.pom | |
Downloading: http://repo1.maven.org/maven2/net/sourceforge/jtds/jtds/1.2.4/jtds-1.2.4.jar | |
[INFO] [clojure:test {execution: default-cli}] | |
Testing clojure.java.test-utilities | |
Testing clojure.java.test-jdbc | |
ERROR in (test-transactions-work-with-generated-keys) (DB.java:370) | |
Uncaught exception, not in assertion. | |
expected: nil | |
actual: java.sql.SQLException: database is locked | |
at org.sqlite.DB.throwex (DB.java:370) | |
org.sqlite.DB.exec (DB.java:76) | |
org.sqlite.Conn.rollback (Conn.java:351) | |
clojure.java.jdbc.internal$transaction_STAR_.invoke (internal.clj:212) | |
clojure.java.test_jdbc$fn__1036$fn__1055$fn__1056.invoke (test_jdbc.clj:335) | |
clojure.java.test_jdbc$fn__1036$fn__1055.invoke (test_jdbc.clj:334) | |
clojure.java.jdbc.internal$with_connection_STAR_.invoke (internal.clj:188) | |
clojure.java.test_jdbc/fn (test_jdbc.clj:332) | |
clojure.test$test_var$fn__6484.invoke (test.clj:693) | |
clojure.test$test_var.invoke (test.clj:693) | |
clojure.test$test_all_vars$fn__6488$fn__6495.invoke (test.clj:709) | |
clojure.java.test_jdbc$clean_up.invoke (test_jdbc.clj:114) | |
clojure.test$compose_fixtures$fn__6478$fn__6479.invoke (test.clj:670) | |
clojure.test$default_fixture.invoke (test.clj:663) | |
clojure.test$compose_fixtures$fn__6478.invoke (test.clj:670) | |
clojure.test$test_all_vars$fn__6488.invoke (test.clj:709) | |
clojure.test$default_fixture.invoke (test.clj:663) | |
clojure.test$test_all_vars.invoke (test.clj:705) | |
clojure.test$test_ns.invoke (test.clj:728) | |
clojure.core$map$fn__3811.invoke (core.clj:2432) | |
clojure.lang.LazySeq.sval (LazySeq.java:42) | |
clojure.lang.LazySeq.seq (LazySeq.java:60) | |
clojure.lang.Cons.next (Cons.java:39) | |
clojure.lang.RT.boundedLength (RT.java:1607) | |
clojure.lang.RestFn.applyTo (RestFn.java:130) | |
clojure.core$apply.invoke (core.clj:602) | |
clojure.test$run_tests.doInvoke (test.clj:743) | |
clojure.lang.RestFn.invoke (RestFn.java:421) | |
com.theoryinpractise.clojure.testrunner$eval1115$fn__1118.invoke (run-test3689069835751614839.clj:29) | |
com.theoryinpractise.clojure.testrunner$eval1115.invoke (run-test3689069835751614839.clj:27) | |
clojure.lang.Compiler.eval (Compiler.java:6465) | |
clojure.lang.Compiler.load (Compiler.java:6902) | |
clojure.lang.Compiler.loadFile (Compiler.java:6863) | |
clojure.main$load_script.invoke (main.clj:282) | |
clojure.main$script_opt.invoke (main.clj:342) | |
clojure.main$main.doInvoke (main.clj:426) | |
clojure.lang.RestFn.invoke (RestFn.java:408) | |
clojure.lang.Var.invoke (Var.java:401) | |
clojure.lang.AFn.applyToHelper (AFn.java:161) | |
clojure.lang.Var.applyTo (Var.java:518) | |
clojure.main.main (main.java:37) | |
Ran 28 tests containing 79 assertions. | |
0 failures, 1 errors. | |
[INFO] ------------------------------------------------------------------------ | |
[ERROR] BUILD ERROR | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Clojure failed. | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] For more information, run Maven with the -e switch | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Total time: 10 seconds | |
[INFO] Finished at: Thu Mar 01 06:10:33 UTC 2012 | |
[INFO] Final Memory: 12M/29M | |
[INFO] ------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest test-transactions-work-with-generated-keys | |
(doseq [db (test-specs)] | |
(sql/with-connection db | |
(create-test-table :fruit db) | |
(try | |
(sql/transaction | |
(sql/set-rollback-only) | |
(sql/insert-values | |
:fruit | |
[:name :appearance] | |
["Grape" "yummy"]) | |
(is (= 1 (sql/with-query-results res ["SELECT * FROM fruit"] (count res)) | |
(is (= 0 (sql/with-query-results res ["SELECT * FROM fruit"] (count res))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment