           :end end
           :params params
           :order order
-         }
-)
-
-
-
-(defn !get-query-results-v2
-  [{:keys [
-           db-table
-		       where
-           start
-           end
-           params
-           order
-           realtime
-           data-session-id
-		   ]}]
+         })
+
+
+
+
+(defn get-count [db-table  where   params]
+                                               (:cnt (sql-1 (str
+                                                  "select count (id) as CNT from "
+                                                  db-table " "
+                                                  (if (-> where count pos?) (str "where " where " "))
+                                                  )
+                                                 params)))
+
+
+
+
+
+
+(defn !get-query-results-v2 [{:keys [
+                                     db-table
+                          		       where
+                                     start
+                                     end
+                                     params
+                                     order
+                                     realtime
+                                     data-session-id
+                          		   ]}]
 
   (println "************************************************************************************")
   (println "!get-query-results-v2*   REALTIME = " realtime)
-
-
-(cond
-   realtime
-  (let [
-  query-key   (create-query-key
-                :db-table db-table
-                :where where
-                :start start
-                :end end
-                :params params
-                :order order
-  )
-  ]
-  (if (get @cached-queries  query-key)
-    nil
-    (swap! cached-queries assoc  query-key {})
-  )
-    (println "-------------------------------")
-   (println cached-queries)
-    (println "-------------------------------")
-  
-  
-
   (println (str "!get-query-results-v2: "
                 db-table
                 where " "

                order " "
                data-session-id " "
                realtime " "
                )))



:else
(do
  (let [
        record-count

        (:cnt (sql-1 (str
                        "select count (id) as CNT from "
                        db-table " "
                        (if (-> where count pos?) (str "where " where " "))
                        )
                       params))










(defn create-query-key [& {:keys [
                                   db-table
                                   where
                                   start
                                   end
                                   params
                                   order
                                   ]}]
         {
          :db-table db-table
          :where where
