[英]This row does not contain values for that table
I'm using Drift(moor).我正在使用漂移(停泊)。 When trying to get a sample of data using leftOuterJoin, the following situation happens: The table that I join via leftOuterJoin returns null as a value.
当尝试使用 leftOuterJoin 获取数据样本时,会发生以下情况:我通过 leftOuterJoin 加入的表返回值 null。 Ie leftOuterJoin itself works correctly but values from joined table are not read and return null. As a result, I get a row where 1 or 2 columns have null values (depending on what table I join) No one with such a situation is not faced?
即 leftOuterJoin 本身工作正常但未读取连接表中的值并返回 null。结果,我得到一行,其中 1 或 2 列具有 null 值(取决于我加入的表)没有人没有遇到这种情况?
final rows = await (select(favoritePlaces).join(
[
leftOuterJoin(
cachedPlaces, cachedPlaces.id.equalsExp(favoritePlaces.placeId)),
],
)).get();
Remove ".get()" from the last line.从最后一行删除“.get()”。
Add below lines after your code:在您的代码后添加以下行:
final result = await rows.get();最终结果 = await rows.get();
return result.map((resultRow) { return FavoritePlacesWithcachedPlaces( resultRow.readTable(favoritePlaces), resultRow.readTableOrNull(cachedPlaces), ); }).toList(); return result.map((resultRow) { return FavoritePlacesWithcachedPlaces( resultRow.readTable(favoritePlaces), resultRow.readTableOrNull(cachedPlaces), ); }).toList();
where FavoritePlacesWithcachedPlaces object is something like:其中 FavoritePlacesWithcachedPlaces object 是这样的:
class FavoritePlacesWithcachedPlaces {
final FavoritePlaces favoritePlaces;
final CachedPlaces? cachedPlaces;
FavoritePlacesWithcachedPlaces (this.favoritePlaces,
this.cachedPlaces);}
The key point is using "readTableOrNull".关键点是使用“readTableOrNull”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.