Skip to content

Instantly share code, notes, and snippets.

@tgoossens
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgoossens/1c4506e7c36b4409fbe4 to your computer and use it in GitHub Desktop.
Save tgoossens/1c4506e7c36b4409fbe4 to your computer and use it in GitHub Desktop.
(defn otable-populate!
"Populate the table with tuples from OTable"
[conn ^com.ooliba.core.model.OTable t name]
(doseq [key (.getAllKeys t)]
(let [tuple (.getTuple t key))
values (map #(-> tuple (.getValue %)) (.getAttributeNames tuple))]
(-> conn (.prepareStatement (query-insert name values)) .executeUpdate)
(-> conn .commit))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment