提交 31372bc0 authored 作者: Noel Grandin's avatar Noel Grandin

split the getTransaction() method

I don't like methods that do something completely different with a null parameter
上级 5d1e64ed
......@@ -66,7 +66,7 @@ public class MVPrimaryIndex extends BaseIndex {
ValueDataType valueType = new ValueDataType(db.getCompareMode(), db,
sortTypes);
mapName = "table." + getId();
Transaction t = mvTable.getTransaction(null);
Transaction t = mvTable.getTransactionBegin();
dataMap = t.openMap(mapName, keyType, valueType);
t.commit();
if (!table.isPersistData()) {
......
......@@ -67,7 +67,7 @@ public class MVSecondaryIndex extends BaseIndex implements MVIndex {
ValueDataType keyType = new ValueDataType(
db.getCompareMode(), db, sortTypes);
ValueDataType valueType = new ValueDataType(null, null, null);
Transaction t = mvTable.getTransaction(null);
Transaction t = mvTable.getTransactionBegin();
dataMap = t.openMap(mapName, keyType, valueType);
t.commit();
if (!keyType.equals(dataMap.getKeyType())) {
......
......@@ -102,7 +102,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
new MVRTreeMap.Builder<VersionedValue>().
valueType(valueType);
spatialMap = db.getMvStore().getStore().openMap(mapName, mapBuilder);
Transaction t = mvTable.getTransaction(null);
Transaction t = mvTable.getTransactionBegin();
dataMap = t.openMap(spatialMap);
t.commit();
}
......
......@@ -845,6 +845,16 @@ public class MVTable extends TableBase {
// ok
}
/**
* Get a new transaction.
*
* @return the transaction
*/
Transaction getTransactionBegin() {
// TODO need to commit/rollback the transaction
return transactionStore.begin();
}
/**
* Get the transaction to use for this session.
*
......@@ -852,10 +862,6 @@ public class MVTable extends TableBase {
* @return the transaction
*/
Transaction getTransaction(Session session) {
if (session == null) {
// TODO need to commit/rollback the transaction
return transactionStore.begin();
}
return session.getTransaction();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论