     ; If this is a record update, so update the internal record
     ; cache
     ; ----------------------------------------------------------------
-    (if (= (get realtime-log-entry :record_operation) "UPDATE")
+    (if (= (get realtime-log-entry (cond (= *database-type* "postgres" ) :record_operation (= *database-type* "oracle") :RECORD_OPERATION)) "UPDATE")
       (do
         (update-record-in-cache  db-table   id)
         (inform-clients-about-record   db-table   id)))


        coils-trigger-exists   (pos? (count coils-trigger))

        sql-to-drop-trigger    (str "DROP TRIGGER IF EXISTS trigger_afterinsert ON " table-name ";")
        sql-to-insert-trigger-row "
        INSERT INTO coils_triggers
        (
        table_name,version
        ) values (?,?);
        "

        sql-to-create-insert-trigger (str "CREATE TRIGGER trigger_afterInsert AFTER INSERT ON " table-name " FOR EACH ROW EXECUTE PROCEDURE trigger_function_afterInsert();")
        sql-to-create-update-trigger (str "CREATE TRIGGER trigger_afterUpdate AFTER UPDATE ON " table-name " FOR EACH ROW EXECUTE PROCEDURE trigger_function_afterUpdate();")
        sql-to-create-delete-trigger (str "CREATE TRIGGER trigger_afterDelete AFTER DELETE ON " table-name " FOR EACH ROW EXECUTE PROCEDURE trigger_function_afterDelete();")
        ]
    ;(println "Coils trigger table exists: " coils-trigger-exists)


    (if (not coils-trigger-exists )
      (do
        (korma.core/exec-raw   [sql-to-insert-trigger-row [table-name  coils-tables-trigger-version]]   [])
        (korma.core/exec-raw   [sql-to-drop-trigger []]   [])
        (korma.core/exec-raw   [sql-to-create-insert-trigger []]   [])
        (korma.core/exec-raw   [sql-to-create-update-trigger []]   [])
        (korma.core/exec-raw   [sql-to-create-delete-trigger []]   [])

        )
      nil)))



(defn parse-id [s]
  (do
    (println (str "(defn parse-id [" s "]"))
    (let [find-num (re-find  #"\d+" s )]
      (if find-num
        (Integer. find-num)
        s))))

(defn get-id-type [ column-type ]
  (do
    (println (str "*******COLTYPE:" column-type ":"))
    (cond
    (= column-type "NUMBER")                       "INTEGER"
    (= column-type "integer")                      "INTEGER"
    (= column-type "character")                    "TEXT"
    (= column-type "character varying")            "TEXT"

    :else                                          "INTEGER"
    )
  ))

