summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
authortim b <timb@camcompu.home>2010-04-08 18:22:25 -0700
committertim b <timb@camcompu.home>2010-04-08 18:22:25 -0700
commit0db7b7ef7a35070bf802a6c3313701d6faa5b3dc (patch)
tree9025a6347992309f01397ad5b9d8ae904749a538 /src/utils.clj
parent6440348618ade4fbcb541c40473074833a47d198 (diff)
favs
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