I am starting out to use Clojure to combine and verify data between DB2 on
a Mainframe, SQL Server and an Atom Feed. Yes, it's such fun working in a
start-up ;-)
Database wise, all is connecting OK after some Leiningen shenanigans and I
am now stuck on the mapping part ;-)
The code is below. I want to generate a set of maps that show the
following:
#({:a2pid 269, :uuid nil}
{:a2pid 270, :uuid nil}
{:a2pid 258, :uuid nil}
{:a2pid 261, :uuid nil}
{:a2pid 251, :uuid E7D4262C-62B3-4129-9CE4-B342DC1C39FC})
The idea is to have a list of maps that can show where there are gaps
between the two DBs and, coming next, the Atom feed.
It is essentially a join operation - and maybe that's what I need but I
cannot figure out where to plonk the magic words.
(defn a2p-records-by-date [query from-date to-date dh-sub-query]
(sql/with-connection db2
(sql/with-query-results rs [query from-date to-date]
(doseq [row rs] (println (str " " (:project_id row) (dh-sub-query
(:project_id row))))))))
(defn dh-records-by-a2p-id [query a2p-id]
(sql/with-connection mssql
(sql/with-query-results rs [query a2p-id]
(dorun (map #(print (:project_uuid %)) rs)))))
(defn dh-sub-query [a2p-id] (dh-records-by-a2p-id "select PROJECT_UUID from
PROJECT where A2P_PROJECT_ID = ?" a2p-id))
(a2p-records-by-date "select project_id from PROJECT where timestamp > ?
and timestamp < ?" "2012-03-02" "2012-03-07" dh-sub-query)
The output looks like this, so I am close!
269
270
258
261
E7D4262C-62B3-4129-9CE4-B342DC1C39FC 251
Can anyone help me out about how to generate the maps?
This is just the start as I have many queries to run for many entities, so
doubtless I will be back again ;-)
Thanks in advance
Ray
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.