use of org.neo4j.kernel.impl.api.KernelStatement in project neo4j by neo4j.
the class NeoStoresTest method deleteRelationships.
private void deleteRelationships(long nodeId) throws Exception {
try (KernelStatement statement = (KernelStatement) tx.acquireStatement();
Cursor<NodeItem> nodeCursor = statement.getStoreStatement().acquireSingleNodeCursor(nodeId)) {
assertTrue(nodeCursor.next());
NodeItem nodeItem = nodeCursor.get();
statement.getStoreStatement().acquireNodeRelationshipCursor(nodeItem.isDense(), nodeItem.id(), nodeItem.nextRelationshipId(), BOTH, ALWAYS_TRUE_INT).forAll(rel -> relDelete(rel.id()));
}
}
use of org.neo4j.kernel.impl.api.KernelStatement in project neo4j by neo4j.
the class NeoStoresTest method assertHasRelationships.
private void assertHasRelationships(long node) {
try (KernelStatement statement = (KernelStatement) tx.acquireStatement();
Cursor<NodeItem> nodeCursor = statement.getStoreStatement().acquireSingleNodeCursor(node)) {
nodeCursor.next();
NodeItem nodeItem = nodeCursor.get();
try (Cursor<RelationshipItem> relationships = statement.getStoreStatement().acquireNodeRelationshipCursor(nodeItem.isDense(), nodeItem.id(), nodeItem.nextRelationshipId(), BOTH, ALWAYS_TRUE_INT)) {
assertTrue(relationships.next());
}
}
}
use of org.neo4j.kernel.impl.api.KernelStatement in project neo4j by neo4j.
the class TransactionStateChecker method create.
public static TransactionStateChecker create(TransitionalPeriodTransactionMessContainer container) {
KernelTransaction topLevelTransactionBoundToThisThread = container.getBridge().getTopLevelTransactionBoundToThisThread(true);
KernelStatement kernelStatement = (KernelStatement) topLevelTransactionBoundToThisThread.acquireStatement();
return new TransactionStateChecker(nodeId -> kernelStatement.hasTxStateWithChanges() && kernelStatement.txState().nodeIsDeletedInThisTx(nodeId), relId -> kernelStatement.hasTxStateWithChanges() && kernelStatement.txState().relationshipIsDeletedInThisTx(relId));
}
Aggregations