koordinates/kart

Kart GPKG working copy not compatible with GlobalMapper

olsen232 opened this issue · 2 comments

GlobalMapper fails to open Kart GPKG working copies, with an malformed-database-schema error

After some digging, turns out GlobalMapper doesn't like this trigger:

CREATE TRIGGER _mytable_upd
   AFTER UPDATE ON mytable
BEGIN
    INSERT OR REPLACE INTO gpkg_kart_track (table_name, pk)
    VALUES ('mytable', NEW.fid), ('mytable', OLD.fid);
END;

Specifically it doesn't understand this form of INSERT:
INSERT [OR REPLACE] INTO <into> VALUES <row1>, <row2>;

If one of the rows-to-insert the trigger is removed, GlobalMapper is happy.
Presumably GlobalMapper uses a very old sqlite version that doesn't understand such things.

As a workaround, Kart could create the update trigger with two insert statements that insert one row each, instead of one trigger that inserts two rows. This has no real downsides (slightly less efficient) so we may as well.

**Version Info **

  • issue is in GlobalMapper 24_1-x64 for 64 bit Windows
rcoup commented

Presumably GlobalMapper uses a very old sqlite version that doesn't understand such things.

Very old being at least 10 years:

SQLite Release 3.7.11 On 2012-03-20

  1. Enhance the INSERT syntax to allow multiple rows to be inserted via the VALUES clause.

This is fixed in release 0.14.1 - if you are affected by this issue, recreate your Kart working copy using Kart 0.14.1 ie
kart create-workingcopy --delete-existing