aboutsummaryrefslogtreecommitdiff
path: root/cljssss-g.clj
diff options
context:
space:
mode:
Diffstat (limited to 'cljssss-g.clj')
-rw-r--r--cljssss-g.clj10
1 files changed, 10 insertions, 0 deletions
diff --git a/cljssss-g.clj b/cljssss-g.clj
index 435c6c5..c99a0df 100644
--- a/cljssss-g.clj
+++ b/cljssss-g.clj
@@ -1,9 +1,12 @@
(ns cljssss-g
(require [clojure.xml :as xml]
+ [clojure.contrib.sql :as sql]
compojure)
(import (org.antlr.stringtemplate StringTemplateGroup))
(use compojure))
+(Class/forName "org.sqlite.JDBC")
+
(def templates (new StringTemplateGroup ""))
(defservlet cljssss-g
@@ -15,5 +18,12 @@
(ANY "*"
(page-not-found)))
+(defmacro with-db [& body]
+ `(sql/with-connection {:classname "org.sqlite.JDBC"
+ :subprotocol "sqlite"
+ :subname "cljssss-g.sqlite3"}
+ (sql/transaction
+ ~@body)))
+
(run-server {:port 8080}
"/*" cljssss-g)