您好,我在一个区域中插入了一个新条目,并在同一个事务中查询了一个OQL(SELECT * FROM / some_region_name),并且我发现在OQL结果中没有返回新的插入条目。任何人都知道发生了什么事吗?
这是我的测试代码:
Transaction begin.
checking username[forrest] before added.
rUserEntity NOT found
checking username[forrest] after added.
**rUserEntity found**
Transaction end.
checking username[forrest] after transaction.
rUserEntity found
我期待结果:
Transaction begin.
checking username[forrest] before added.
rUserEntity NOT found
checking username[forrest] after added.
**rUserEntity NOT found**
Transaction end.
checking username[forrest] after transaction.
rUserEntity found
但不幸的是我得到了这个结果:
foreach ($_REQUEST as $value)
{
$sql = "INSERT INTO beer (b_beer) VALUES ('$value');";
if(mysqli_query($connection, $sql))
{
echo "Records added successfully.";
}
else
{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($connection);
}
}
答案 0 :(得分:1)
这是一个已知的限制。 From the docs:
Queries and indexes reflect the cache contents and ignore the changes
made by ongoing transactions. If you do a query from inside a transaction,
the query does not reflect the changes made inside that transaction.