@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
@Test public void testAnonProcTransaction() throws Exception { ProcedurePlan plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin select 1; end", RealMetadataFactory.example1Cached()); assertFalse(plan.requiresTransaction(false)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin select * from pm1.g1; end", RealMetadataFactory.example1Cached()); assertNull(plan.requiresTransaction(true)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin insert into pm1.g1 (e1) values ('a'); end", RealMetadataFactory.example1Cached()); assertNull(plan.requiresTransaction(false)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin if (true) insert into pm1.g1 (e1) values ('a'); else insert into pm1.g1 (e1) values ('b'); end", RealMetadataFactory.example1Cached()); assertNull(plan.requiresTransaction(false)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin loop on (select e1 from pm1.g1) as x begin insert into pm1.g1 (e1) values (x.e1); end end", RealMetadataFactory.example1Cached()); assertNull(plan.requiresTransaction(false)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin execute immediate 'select 1'; end", RealMetadataFactory.example1Cached()); assertFalse(plan.requiresTransaction(false)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin execute immediate 'select 1'; end", RealMetadataFactory.example1Cached()); assertNull(plan.requiresTransaction(true)); plan = (ProcedurePlan) TestProcessor.helpGetPlan("begin execute immediate 'select 1' update *; end", RealMetadataFactory.example1Cached()); assertTrue(plan.requiresTransaction(false)); }
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false); boolean start = false; if (txnRequired == null) {
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false); boolean start = false; if (txnRequired == null) {
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false); boolean start = false; if (txnRequired == null) {