void exec(AgentProxy& ap, typename AgentProxy::handler_type hdl) const final {
   auto node = this->get_first_child();
   if (node && m_count > 0) {
     exec_impl(ap, node, m_count, false, std::move(hdl));
   } else {
     ap(hdl, false);
   }
 }
Example #2
0
void statement::run_exec()
{
    if (sm_)
    {
        std::string bindings = bindings_.str();
        boost::timer t;
        try 
        {
            exec_impl();
        }
        catch(...)
        {
            sm_->statement_executed(patched_query().c_str(), bindings, false, t.elapsed(), 0);
            throw;
        }

        sm_->statement_executed(patched_query().c_str(), bindings, true, t.elapsed(), affected());
    }
    else
        exec_impl();
}
 void exec_impl(AgentProxy& ap,
                abstract_node<AgentProxy>* node,
                size_t count,
                bool current,
                typename AgentProxy::handler_type hdl) const {
   if (count > 0) {
     node->exec(ap, [=, &ap] (bool result, typename AgentProxy::agent_type*) {
       exec_impl(ap, node, count - 1, current || result, std::move(hdl));
     });
   } else {
     ap(hdl, current);
   }
 }
	void exec_impl(	AgentProxy& ap,
					abstract_node<AgentProxy>* node,
					typename AgentProxy::handler_type hdl) const {
		if (node) {
			node->exec(ap, [=, &ap] (bool result, void*) {
				if (!result) {
					ap(hdl, false);
				} else {
					exec_impl(ap, node->get_next_sibling(), std::move(hdl));
				}
			});
		} else {
			ap(hdl, true);
		}
	}
	void exec(AgentProxy& ap, typename AgentProxy::handler_type hdl) const final {
		exec_impl(ap, this->get_first_child(), std::move(hdl));
	}