Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation error on sql/with-db-transaction #4

Closed
jaromil opened this issue Jan 27, 2018 · 2 comments
Closed

compilation error on sql/with-db-transaction #4

jaromil opened this issue Jan 27, 2018 · 2 comments

Comments

@jaromil
Copy link

jaromil commented Jan 27, 2018

Nice idea! wanted to try duratom, but cannot build it into my project because of this compilation error below. I'm using Clojure 1.9:

Clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: sql/with-db-transaction, compiling:(duratom/utils.clj:71:3)
             java.lang.RuntimeException: No such var: sql/with-db-transaction
@jimpil
Copy link
Owner

jimpil commented Jan 27, 2018

Hi there... This is strange! duratom does selective loading of backend-related mutator functions. For example, you can see in duratom.utils.clj the following snippet:

(try
  (require '[clojure.java.jdbc :as sql]) ;; attempt to load the proper ns
  (catch Exception e
    (require '[duratom.not-found.jdbc :as sql]))) ;; not-found  - load the dummy one

So basically, if clojure.java.jdbc is not found on the classpath, the dummy versions will be loaded (which throw exceptions when called). This is precisely done in order to avoid compilation errors like the one you're seeing. So I'm not sure what is the problem in your project...Could you elaborate a bit more on your project? How does your project.clj look like? Which duratom namespace are you requiring in your namespace?

I tried importing duratom 0.3.7 in another project of mine, picked up a random ns, and added this line:
(:require [duratom.utils :as ut]). The namespace was loaded/compiled just fine, and i could call functions from it. If there was an issue with duratom I would have gotten the same exception as you. I didn't though, so I'm inclined to say that something is wrong with your code/project.

I'm happy to help out in resolving the issue, but first I'll need to reproduce it locally. If you can provide a minimal example/project that reproduces it, I'll jump straight on it. :)

@jaromil
Copy link
Author

jaromil commented Jan 28, 2018

Thanks for your answer! I did notice the wrapper implementation in utils and was also wondering why it doesn't takes effect. So far I'm just sloppily trying stuff and have already deleted the test project, but I'll come back to this with more information on the next try as soon as I setup a new environment, meanwhile I guess I can close this issue.

@jaromil jaromil closed this as completed Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants