           where (if (empty? predicates) "" (str "where " (s/join " AND " predicates)))
           sql (str "select " (s/join "," fields) "from " (s/join "," tables) where)
           rs (.executeQuery stmt sql)]
-      (read-rs rs limit)
+      (read-rs rs :limit limit :offset offset)
       )))

(defn table-cols [ds name]
  (with-db-metadata [meta ds]
    (with-open [rs (.getColumns meta nil nil name "%")]
      (read-rs rs ["COLUMN_NAME" "DATA_TYPE" "TYPE_NAME" "COLUMN_SIZE" "DECIMAL_DIGITS" "NULLABLE" "ORDINAL_POSITION"] 200))) )

(defn exec-query [ds {:keys [tables fields predicates offset limit]}]
  (with-open [con (.getConnection (:datasource ds))]

       {:error (.getMessage e#)}))
  )

(defn ^:private rs-rows [rs cols offset limit]
  (if (and (> offset 0) (= ResultSet/TYPE_SCROLL_INSENSITIVE (.getType rs)))
    (.absolute rs offset)
    )
  (loop [rows [] count 0]
    (if (and (.next rs) (< count limit))
      (let [row (doall (map #(.getObject rs %) cols))]
        (recur (conj rows row) (inc count))
        )
      rows
      )
    )
  )

(defn ^:private read-rs
  [rs & {:keys [offset limit columns] :or {offset 0 limit 100}}]
  (if (some? columns)
    {:columns columns :rows (rs-rows rs columns offset limit)}
    (let [rs-meta (.getMetaData rs)
          col-size (inc (.getColumnCount rs-meta))
          cols (if (columns) columns (doall (map #(.getColumnName rs-meta %) (range 1 col-size))))]
      {:columns cols :rows (rs-rows rs cols offset limit)}
      )
    )
  )

(defn mk-ds [{:keys [dbms url user_name password]}]
