                       (insert tracker (values {:tracker_code tracker-code
                                                :name (or tracker-name tracker-code)}))))))
 
+;; TODO needed
 (defn get-all-trackers []
   (select tracker)
   )

(ns ruuvi-server.database.event-dao
  (:require [ruuvi-server.configuration :as conf]
            [ruuvi-server.util :as util]
            [clojure.string :as string])
  (:use [korma.db :only (transaction)]
        [korma.core :only (select where insert update values
                                  set-fields with limit order fields)]

                 (with event-location)
                 (with event-extension-value)
                 (where {:id event_id})))
  )

(def ^{:private true} cache-event-extra-data (cache/create-cache-region :event-extra-data 10000 (* 60 60 1000)))

(defn- get-event-extra-data [event-id]
    {:event_locations (select event-location
                              (where {:event_id event-id}))
     :event_extension_values (select event-extension-value
                                     (fields :value)
                                     (with event-extension-type (fields :name))
                                     (where {:event_id event-id}))
     }
  )

(defn search-events 
