                (<= post-time (.getTime (java.util.Date.)))
                edit-time
                (<= edit-time (.getTime (java.util.Date.))))
-      (jdbc/with-connection
+      (update-or-insert!
         @spec
-        (jdbc/update-or-insert-values
-          :post
-          ["userhash = ? AND time = ?" user-hash post-time]
-          {:realuserhash user-hash 
-           :userhash user-hash
-           :body (f/b-decode-string (get args "body"))
-           :time post-time
-           :mtime edit-time
-           :pichash (f/b-decode-bytes (get pics 0))
-           :count (count pics)
-           :ptrhash (f/b-decode-bytes (get args "ptrhash"))
-           :ptrtime (f/b-decode-long (get args "ptrtime"))
-           :status (f/b-decode-long (get args "status"))})))))
+        :post
+        {:realuserhash user-hash 
+         :userhash user-hash
+         :body (f/b-decode-string (get args "body"))
+         :time post-time
+         :mtime edit-time
+         :pichash (f/b-decode-bytes (get pics 0))
+         :count (count pics)
+         :ptrhash (f/b-decode-bytes (get args "ptrhash"))
+         :ptrtime (f/b-decode-long (get args "ptrtime"))
+         :status (f/b-decode-long (get args "status"))}
+        ["userhash = ? AND time = ?" user-hash post-time]))))
 
 (defn insert-fav
   [user-hash fav-time args]

                           LIMIT 1" tag]
                    nil)]
    (when statement
      (jdbc/with-connection
        @spec
        (jdbc/with-query-results
          rs
          statement
          (first (prepare-results rs :tag)))))))

(defn get-pic-data
  ([params]
   (let [user-hash (:userhash params)
         pic-hash (:pichash params)]
     (jdbc/with-connection
       @spec
       (jdbc/with-query-results
         rs
         ["SELECT * FROM pic WHERE userhash = ? AND pichash = ?"
          user-hash pic-hash]
         (prepare-results rs :pic)))))
  ([params ptr-time paginate?]
   (let [user-hash (:userhash params)
         page (:page params)]
     (jdbc/with-connection
       @spec
       (jdbc/with-query-results
         rs
         [(let [sql "SELECT * FROM pic WHERE userhash = ? AND ptrtime IS ?"]
            (if paginate? (paginate page sql) sql))
          user-hash ptr-time]
         (prepare-results rs :pic))))))

; insertion / removal


                                  ORDER BY count DESC"]
                           nil))]
    (when statement
      (-> (jdbc/query
            @spec
            (vec (concat [(paginate (:page params) (first statement))]
                         (rest statement))))
          (prepare-results (or sub-type data-type))))))

(defn get-single-tag-data
  [params]
