On Jan 7, 2009, at 12:11 PM, ssecorp wrote:
This was going to be a question but I solved it before I finished the post :) Figured I might post the solution then, hopefully it will help someone else.
Very cool.
(ns progs.netflix.db (:require (clojure.contrib [sql :as sql])) (:require (clojure.contrib.sql [internal :as internal]))) (load-file "C:/clojure/user.clj") (def db {:classname "org.postgresql.Driver" :subprotocol "postgresql" :subname "//localhost/flonk" :user "postgres" :password "1234qwer" }) (defn drop-deleta [] (try (sql/drop-table :deleta) (catch Exception e))) (defn create-and-drop-previous [] (sql/with-connection db (sql/transaction (drop-deleta))))
The goal is for you not to need "sql.internal". I made a recent change that makes "(connection)" available without it. If you're still using it, please let me know why and I'll try to fix it.
If C:/clojure is in your classpath, user.clj will be loaded at the time you launch the repl or script. You shouldn't need to load it in code you deploy. If you're doing it at the repl, I would prefer to use (require 'user.clj :reload) and avoid load-file in nearly every case.
--Steve
smime.p7s
Description: S/MIME cryptographic signature