1

您可以在此处阅读有关 total_changes() 的信息: https ://www.sqlite.org/lang_corefunc.html

我在使用 python 接口到 spatialite (pyspatialite) 时看到了这个问题,但可以用 windows spatialite.exe 重现这个问题。请注意 spatialite.exe total_changes 不是 0 如预期的那样,并且随着每个 select 语句的增加而增加 - 很奇怪。它应该只为更新、插入和删除而增加。还要注意 sqlite 是正确的。任何建议表示赞赏?

    C:\crs\bde2>spatialite test6.db
    SpatiaLite version ..: 4.2.0    Supported Extensions:
            - 'VirtualShape'        [direct Shapefile access]
            - 'VirtualDbf'          [direct DBF access]
            - 'VirtualXL'           [direct XLS access]
            - 'VirtualText'         [direct CSV/TXT access]
            - 'VirtualNetwork'      [Dijkstra shortest path]
            - 'RTree'               [Spatial Index - R*Tree]
            - 'MbrCache'            [Spatial Index - MBR cache]
            - 'VirtualSpatialIndex' [R*Tree metahandler]
            - 'VirtualXPath'        [XML Path Language - XPath]
            - 'VirtualFDO'          [FDO-OGR interoperability]
            - 'VirtualGPKG' [OGC GeoPackage interoperability]
            - 'VirtualBBox'         [BoundingBox tables]
            - 'SpatiaLite'          [Spatial SQL - OGC]
    PROJ.4 version ......: Rel. 4.8.0, 6 March 2012
    GEOS version ........: 3.4.2-CAPI-1.8.2 r3921
    LWGEOM version ......: 2.1.3
    TARGET CPU ..........: mingw32
    SQLite version ......: 3.8.5
    Enter ".help" for instructions
    SQLite version 3.8.5 2014-06-04 14:06:34
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    spatialite>
    spatialite>
    spatialite> SELECT total_changes() AS 'Total changes';
    1
    spatialite> SELECT total_changes() AS 'Total changes';
    3
    spatialite> .quit

    C:\crs\bde2>sqlite3 test6.db
    SQLite version 3.8.7 2014-10-17 11:24:17
    Enter ".help" for usage hints.
    sqlite>
    sqlite> select total_changes() as 'Total changes';
    0
    sqlite> select total_changes() as 'Total changes';
    0
4

1 回答 1

0

文档说:

sqlite3_total_changes() 返回的计数包括来自所有触发器上下文的所有更改和外键操作所做的更改。

SpatiaLite 使用大量触发器和运行 SQL 命令的用户定义函数。

于 2014-12-16T09:42:28.250 回答