在带有返回值的执行块中执行时,不会持久插入

问题描述 投票:0回答:1

我尝试使用execute block将两个值插入到我的数据库中并返回插入id。

execute block returns (id integer)
as begin
  insert into test (name) values ('test1') returning id into :id;
  suspend;
  insert into test (name) values ('test2') returning id into :id;
  suspend;
end;

如果我不调用fetch|fetchAll方法,则插入不会保留在数据库中。

查询执行多次读取结果集后,我无法调用fetchAll。但是如果我在那里调用,插入是持久的,我可以获得返回值。

php pdo firebird
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.