我们假设以下数据集:
+---------------+-----------+---------------------+ | flightCarrier | saleTotal | daysBeforeDeparture | +---------------+-----------+---------------------+ | KL | 477.99 | 0 | | AF | 457.99 | 0 | | SQ | 556.31 | 0 | +---------------+-----------+---------------------+
我想做的是以下内容:
工作单:
到目前为止我尝试过的:
cal <- apply(df_matrix[1:2,2], 1, function(x) {
A <- x
x <- x[-1]
ifelse(x>A, 1, ifelse(x<A, 0, NA))
}) …Run Code Online (Sandbox Code Playgroud) 我目前正在努力从nativquerySymfony 2.4.3中获取结果.简单来说,我正在构建一个JobQueue/MsgQueue系统,它只会添加/删除队列中的作业.过程将获取第一个作业,将其设置为活动状态,并且应该返回整个结果.确实存在问题 - 我无法取任何东西.
我以此为例:如何使用Doctrine2和MySQL执行存储过程
这是我在以下代码中使用的代码ConsoleCommand Class:
protected function execute(InputInterface $input, OutputInterface $output)
{
## start
$output->writeln('<comment>Starting JobQueue Ping process</comment>');
// set doctrine
$em = $this->getContainer()->get('doctrine')->getManager();
$rsm = new ResultSetMapping;
$result = $em->createNativeQuery(
'CALL JobQueueGetJob (' .
':jobTypeCode' .
')', $rsm
);
$result->setParameters(array('jobTypeCode' => 1));
$result->execute();
$em->flush();
if ($input->getOption('verbose')) {
$output->writeln(var_dump($result->getResult()));
}
}
Run Code Online (Sandbox Code Playgroud)
在这里,您将使用过程代码和结果:
代码
PROCEDURE `JobQueueGetJob`(IN `jobType` TINYINT(2))
BEGIN
DECLARE jId int(11);
SELECT `msgId` into jId FROM `jobqueue` WHERE `MsgTypeCode` = jobType AND `jState` …Run Code Online (Sandbox Code Playgroud)