From 00de9bbbc560dfdcc0d94d965090db2d4794f498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Mon, 17 Oct 2016 19:23:11 +0200 Subject: [PATCH] Database.create(virtualTable:using:) wraps the table creation and virtual module post actions in a save point. Fix failing test for virtual module that throws in its database(_:didCreate:using:) method. --- GRDB/QueryInterface/VirtualTableModule.swift | 8 +++++--- TODO.md | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GRDB/QueryInterface/VirtualTableModule.swift b/GRDB/QueryInterface/VirtualTableModule.swift index b2590d172..296d4b346 100644 --- a/GRDB/QueryInterface/VirtualTableModule.swift +++ b/GRDB/QueryInterface/VirtualTableModule.swift @@ -114,9 +114,11 @@ extension Database { chunks.append(module.moduleName + "(" + arguments.joined(separator: ", ") + ")") } let sql = chunks.joined(separator: " ") - try execute(sql) - // Post creation actions - try module.database(self, didCreate: tableName, using: definition) + try inSavepoint { + try execute(sql) + try module.database(self, didCreate: tableName, using: definition) + return .commit + } } } diff --git a/TODO.md b/TODO.md index 590b35012..3d278a128 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,3 @@ -- [ ] create(virtualTable:using:) should use a savepoint. -- [ ] FTS5 trigger boilerplate for external content tables: https://github.com/groue/WWDCCompanion/blob/master/WWDCCompanion/Models/Database.swift - [ ] Row to dictionary conversion - [ ] FTS3Record.fetchCount(db) - [ ] FTS: check https://www.sqlite.org/spellfix1.html