summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.clj')
-rwxr-xr-xsrc/utils.clj19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/utils.clj b/src/utils.clj
index 92fdad6..3f2f4e4 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -1,6 +1,7 @@
(ns utils
(:import java.text.SimpleDateFormat
- java.util.Date)
+ java.util.Date
+ java.net.URLDecoder)
(:use clojure.contrib.json.write
clojure.contrib.sql))
@@ -13,6 +14,8 @@
:user "postgres"
:password "root"}))
+;; moved this to here which doesn't seem right... maybe a 'settings.clj' or something?
+(def *dumps-per-page* 20)
;; Misc
@@ -70,6 +73,10 @@
(with-connection *db*
(delete-rows table query)))
+(defn do-insert [table cols values]
+ (with-connection *db*
+ (insert-values table cols values)))
+
;; Parsing
(defn maybe-parse-int
@@ -79,4 +86,12 @@
(catch NumberFormatException _ default))))
(defn maybe-parse-long [s f]
- (if s (Long/parseLong s) f)) \ No newline at end of file
+ (if s (Long/parseLong s) f))
+
+(defn url-decode [text]
+ (URLDecoder/decode text "UTF-8"))
+
+(defn #^String lower-case
+ "Converts string to all lower-case."
+ [#^String s]
+ (.toLowerCase s)) \ No newline at end of file