Skip to content

Instantly share code, notes, and snippets.

@kmtr
Created December 12, 2013 15:31
Show Gist options
  • Select an option

  • Save kmtr/7929809 to your computer and use it in GitHub Desktop.

Select an option

Save kmtr/7929809 to your computer and use it in GitHub Desktop.
insert a file object to blob
(ns beaconlog.db
(:use clojure.core)
(:require [clojure.java.jdbc :as j]))
(defn insert-file [file]
(j/db-transaction [db db-spec]
(let [buffer (byte-array (.length file))]
(j/insert! db :blob_table {:binary buffer}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment