SQLite 选择后跟插入/更新

时间:2021-07-06 20:52:24

标签: javascript sql react-native sqlite expo

我正在尝试在 Expo 中的 SQLite 中执行以下序列,但它似乎并不一致。

BEGIN EXCLUSIVE TRANSACTION;  -- I tried immediate and deferred already
select id from artifacts where encryptedArtifactId = ?; -- I store the result

-- if resultSet size == 0
insert into artifacts ...

-- else if resultSet size == 1
update artifacts

-- finally
commit / rollback

但在随机出现时,它没有给我任何结果并尝试插入。

我是否在 SQLite 上遗漏了一些“刷新”的东西

我无法解决 https://stackoverflow.com/a/67911519/242042 的问题,因为我使用的是 PRIMARY KEYAUTOINCREMENT。我也无法执行 SQLite 3.24 UPSERT 操作,因为它在 expo 或我的设备中不可用。

0 个答案:

没有答案