Skip to content

Instantly share code, notes, and snippets.

@jebberjeb
Created May 8, 2014 15:31
Show Gist options
  • Save jebberjeb/1e7ac56eb6fbc5120581 to your computer and use it in GitHub Desktop.
Save jebberjeb/1e7ac56eb6fbc5120581 to your computer and use it in GitHub Desktop.

defsproc

How it works now

(def sproc-map {:sproc "webicon.p_get_prop"
                :params [{:name :ipropid :type :string}
                         {:name :cursor :type :cursor :output true}
                         ...]})

(defsproc get-property sproc-map [:ipropid] (first cursor))

;; Generates a bunch of jdbc code to call the sproc, compiles it, so you
;; only need to use defsproc once, and youve got a reusable function named
;; get-property

user=> (get-property 96975)
{:iname "Hamilton Heights" :iaddress "10212 NW ..." ...}

Problem

Sometimes sproc versions change, and we dont know. Frequently happens in CI, QA, not so much prod.

Troubleshooting means hearing about the problem on the front end, checking logs for a stacktrace, usually interpreting a cryptic jdbc SQLException (mixed w/ Clojure exception goodness).

Solution - check and report

lein defsproc validate

iws-oracle.properties/get-properties ... true
iws-oracle.properties/get-reviews ... true
iws-oracle.domains/put-domain ... false
...

Then what?

  • Break the build?
  • /check-sprocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment