 (defn read-from-product-table
     "Read selected column from the given product id."
     [product-id what]
+    (log/info product-id what)
     (try
         (-> (jdbc/query db-spec/hurvinek-db
                             [(str "select " (name what) " from products where id=?") product-id])

(defn read-product-name
    "Read name of product for the given product id."
    [product-id]
    (read-from-product-table product-id :name))

(defn read-product-description
    "Read description of product for the given product id."
    [product-id]
    (read-from-product-table product-id :description))

(defn read-name-for-id
    [table-name id]
    (try
        (-> (jdbc/query db-spec/hurvinek-db
                            [(str "select name from " table-name " where id=?") id])

(defn read-chapter-name
    "Read name of chapter for the given chapter id."
    [chapter-id]
    (log/info chapter-id)
    (read-name-for-id "chapters" chapter-id))

(defn read-group-name
    "Read name of group for the given group id."
    [group-id]
    (log/info group-id)
    (read-name-for-id "groups" group-id))

(defn read-component-name
    "Read name of component for the given component id."
    [component-id]
    (log/info component-id)
    (read-name-for-id "components" component-id))

(defn read-chapters
    "Read list of all chapters for selected product."
    [product-id]
    (log/info product-id)
    (try
        (jdbc/query db-spec/hurvinek-db
                        ["select id, name from chapters where product=? order by name" product-id])
