private void Process(EPOnDemandPreparedQueryParameterized q, int id) { q.SetObject(1, id); EPService.EPRuntime.ExecuteQuery(q); _stageOutput.Push(id); NumberOfOperations++; }
private void RunQuery(String epl, String fields, Object[][] expected, ContextPartitionSelector[] selectors) { // try FAF without prepare EPOnDemandQueryResult result = _epService.EPRuntime.ExecuteQuery(epl, selectors); EPAssertionUtil.AssertPropsPerRowAnyOrder(result.Array, fields.Split(','), expected); // test unparameterized prepare and execute EPOnDemandPreparedQuery preparedQuery = _epService.EPRuntime.PrepareQuery(epl); EPOnDemandQueryResult resultPrepared = preparedQuery.Execute(selectors); EPAssertionUtil.AssertPropsPerRowAnyOrder(resultPrepared.Array, fields.Split(','), expected); // test unparameterized prepare and execute EPOnDemandPreparedQueryParameterized preparedParameterizedQuery = _epService.EPRuntime.PrepareQueryWithParameters(epl); EPOnDemandQueryResult resultPreparedParameterized = _epService.EPRuntime.ExecuteQuery(preparedParameterizedQuery, selectors); EPAssertionUtil.AssertPropsPerRowAnyOrder(resultPreparedParameterized.Array, fields.Split(','), expected); // test SODA prepare and execute EPStatementObjectModel modelForPrepare = _epService.EPAdministrator.CompileEPL(epl); EPOnDemandPreparedQuery preparedQueryModel = _epService.EPRuntime.PrepareQuery(modelForPrepare); EPOnDemandQueryResult resultPreparedModel = preparedQueryModel.Execute(selectors); EPAssertionUtil.AssertPropsPerRowAnyOrder(resultPreparedModel.Array, fields.Split(','), expected); // test model query EPStatementObjectModel model = _epService.EPAdministrator.CompileEPL(epl); result = _epService.EPRuntime.ExecuteQuery(model, selectors); EPAssertionUtil.AssertPropsPerRowAnyOrder(result.Array, fields.Split(','), expected); }
public override void Run(EPServiceProvider epService) { epService.EPAdministrator.CreateEPL("create context SegmentedByString partition by TheString from SupportBean"); epService.EPAdministrator.CreateEPL("context SegmentedByString create window MyWindow#keepall as SupportBean"); epService.EPAdministrator.CreateEPL("context SegmentedByString insert into MyWindow select * from SupportBean"); epService.EPRuntime.SendEvent(new SupportBean("G1", 0)); string expected = "Error executing statement: Named window 'MyWindow' is associated to context 'SegmentedByString' that is not available for querying without context partition selector, use the ExecuteQuery(epl, selector) method instead [select * from MyWindow]"; try { epService.EPRuntime.ExecuteQuery("select * from MyWindow"); } catch (EPException ex) { Assert.AreEqual(expected, ex.Message); } EPOnDemandPreparedQueryParameterized prepared = epService.EPRuntime.PrepareQueryWithParameters("select * from MyWindow"); try { epService.EPRuntime.ExecuteQuery(prepared); } catch (EPException ex) { Assert.AreEqual(expected, ex.Message); } }
private void Process(EPOnDemandPreparedQueryParameterized q, int id) { q.SetObject(1, id); var result = EPService.EPRuntime.ExecuteQuery(q); Assert.AreEqual(1, result.Array.Length, "failed for id " + id); Assert.AreEqual(id, result.Array[0].Get("p0")); _stageOutput.Push(id); NumberOfOperations++; }