public static TransactionStateChecker Create(TransitionalPeriodTransactionMessContainer container) { KernelTransaction topLevelTransactionBoundToThisThread = container.Bridge.getKernelTransactionBoundToThisThread(true); KernelStatement kernelStatement = ( KernelStatement )topLevelTransactionBoundToThisThread.AcquireStatement(); return(new TransactionStateChecker(kernelStatement, nodeId => kernelStatement.HasTxStateWithChanges() && kernelStatement.TxState().nodeIsDeletedInThisTx(nodeId), relId => kernelStatement.HasTxStateWithChanges() && kernelStatement.TxState().relationshipIsDeletedInThisTx(relId))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void closeStatementOnClose() public virtual void CloseStatementOnClose() { KernelTransaction kernelTransaction = mock(typeof(KernelTransaction)); Statement statement = mock(typeof(Statement)); when(kernelTransaction.AcquireStatement()).thenReturn(statement); //noinspection EmptyTryBlock using (IndexProcedures ignored = new IndexProcedures(kernelTransaction, null)) { } verify(statement).close(); }
/// <param name="start"> the label of the start node of relationships to get the number of, or {@code null} for "any". </param> /// <param name="type"> the type of the relationships to get the number of, or {@code null} for "any". </param> /// <param name="end"> the label of the end node of relationships to get the number of, or {@code null} for "any". </param> private long CountsForRelationship(Label start, RelationshipType type, Label end) { KernelTransaction ktx = _ktxSupplier.get(); using (Statement ignore = ktx.AcquireStatement()) { TokenRead tokenRead = ktx.TokenRead(); int startId; int typeId; int endId; // start if (start == null) { startId = [email protected]_Fields.ANY_LABEL; } else { if ([email protected]_Fields.NO_TOKEN == (startId = tokenRead.NodeLabel(start.Name()))) { return(0); } } // type if (type == null) { typeId = [email protected]_Fields.ANY_RELATIONSHIP_TYPE; } else { if ([email protected]_Fields.NO_TOKEN == (typeId = tokenRead.RelationshipType(type.Name()))) { return(0); } } // end if (end == null) { endId = [email protected]_Fields.ANY_LABEL; } else { if ([email protected]_Fields.NO_TOKEN == (endId = tokenRead.NodeLabel(end.Name()))) { return(0); } } return(ktx.DataRead().countsForRelationship(startId, typeId, endId)); } }
public override IndexHits <Relationship> Query(object queryOrQueryObjectOrNull, Node startNodeOrNull, Node endNodeOrNull) { KernelTransaction ktx = TxBridge.get(); try { using (Statement ignore = ktx.AcquireStatement()) { RelationshipExplicitIndexCursor cursor = ktx.Cursors().allocateRelationshipExplicitIndexCursor(); long source = startNodeOrNull == null ? NO_SUCH_NODE : startNodeOrNull.Id; long target = endNodeOrNull == null ? NO_SUCH_NODE : endNodeOrNull.Id; ktx.IndexRead().relationshipExplicitIndexQuery(cursor, NameConflict, queryOrQueryObjectOrNull, source, target); return(new CursorWrappingRelationshipIndexHits(cursor, GraphDatabase, ktx, NameConflict)); } } catch (ExplicitIndexNotFoundKernelException) { throw new NotFoundException(Type + " index '" + NameConflict + "' doesn't exist"); } }