Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure 更新值未在hsqldb上生成实际更新_Clojure_Hsqldb - Fatal编程技术网

Clojure 更新值未在hsqldb上生成实际更新

Clojure 更新值未在hsqldb上生成实际更新,clojure,hsqldb,Clojure,Hsqldb,我是新来clojure的。一直在使用hsqldb玩jdbc 此函数是否用于更新表“persona”,其中字段“cedula”是主键 (defn update [cedula x] (sql/with-connection common/database (sql/update-values :persona ["cedula=?" cedula] x))) 在REPL中运行此命令 (per/update 111 {:cedula 122 :nombre "Raul" :

我是新来clojure的。一直在使用hsqldb玩jdbc

此函数是否用于更新表“persona”,其中字段“cedula”是主键

(defn update [cedula x]
(sql/with-connection common/database
    (sql/update-values :persona
        ["cedula=?" cedula] x)))
在REPL中运行此命令

(per/update 111 {:cedula 122 :nombre "Raul" :cargo "mm"})
但在那之后,如果我转到数据库中的.log文件,我会看到它先删除,然后插入

/*C15*/SET SCHEMA PUBLIC
CONNECT USER SA
SET AUTOCOMMIT FALSE
DELETE FROM PERSONA WHERE CEDULA=111
INSERT INTO PERSONA VALUES(122,'Raul','mm')
COMMIT
SET AUTOCOMMIT TRUE
DISCONNECT

这正常吗?

这是更新值的代码:

(defn update-values
  "Updates values on selected rows in a table. where-params is a vector
  containing a string providing the (optionally parameterized) selection
  criteria followed by values for any parameters. record is a map from
  strings or keywords (identifying columns) to updated values."
  [table where-params record]
  (let [[where & params] where-params
        column-strs (map as-identifier (keys record))
        columns (apply str (concat (interpose "=?, " column-strs) "=?"))]
    (do-prepared
      (format "UPDATE %s SET %s WHERE %s"
              (as-identifier table) columns where)
      (concat (vals record) params))))
正如您所看到的,它绝对不可能生成任何东西,除非它应该生成一个更新。那么到底发生了什么

:

由于HyperSQL将DDL和DML语句记录在.log文件中,因此该文件可用于检查发送到数据库的内容请注意,UPDATE语句由DELETE后跟INSERT语句表示。

因此,HSQLDB日志只是简单地编写了一个DELETE和INSERT,即使执行的查询实际上是一个更新