mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
fix: invalid exec sql in node
This commit is contained in:
@@ -78,7 +78,9 @@
|
||||
(let [sql (gobj/get opts-or-sql "sql")
|
||||
bind (gobj/get opts-or-sql "bind")
|
||||
row-mode (gobj/get opts-or-sql "rowMode")
|
||||
bind' (if (and bind (object? bind))
|
||||
bind' (cond
|
||||
(array? bind) bind
|
||||
(and bind (object? bind))
|
||||
(let [out (js-obj)]
|
||||
(doseq [key (js/Object.keys bind)]
|
||||
(let [value (gobj/get bind key)
|
||||
@@ -88,7 +90,7 @@
|
||||
:else key)]
|
||||
(gobj/set out normalized value)))
|
||||
out)
|
||||
bind)
|
||||
:else bind)
|
||||
^js stmt (.prepare db sql)]
|
||||
(if (= row-mode "array")
|
||||
(do
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
(.exec db #js {:sql sql
|
||||
:bind (clj->js params)}))
|
||||
(catch :default e
|
||||
(log/error :rtc-debug-log-insert-failed e))))
|
||||
(log/error :rtc-debug-log-insert-failed [e sql (clj->js params)]))))
|
||||
|
||||
(defn log-tx!
|
||||
[repo tx-data tx-meta]
|
||||
(when repo
|
||||
(when-let [db (worker-state/get-sqlite-conn repo :debug-log)]
|
||||
(insert! db
|
||||
"INSERT INTO tx_log (tx_data, tx_meta) VALUES (?1, ?2)"
|
||||
"INSERT INTO tx_log (tx_data, tx_meta) VALUES (?, ?)"
|
||||
[(safe-str tx-data) (safe-str tx-meta)])
|
||||
(log/debug :log-tx tx-meta))))
|
||||
|
||||
@@ -58,5 +58,5 @@
|
||||
(when (and repo message)
|
||||
(when-let [db (worker-state/get-sqlite-conn repo :debug-log)]
|
||||
(insert! db
|
||||
"INSERT INTO messages (direction, message) VALUES (?1, ?2)"
|
||||
"INSERT INTO messages (direction, message) VALUES (?, ?)"
|
||||
[(name direction) (str message)])))))
|
||||
|
||||
Reference in New Issue
Block a user