Anorm Mysql存储过程调用 [英] Anorm Mysql Stored Procedure calling

查看:107
本文介绍了Anorm Mysql存储过程调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我简单的存储过程,

This is my simple stored procedure ,

DELIMITER $$

USE `TestDB`$$

DROP PROCEDURE IF EXISTS `test123`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `test123`(id INT(11) , user_name VARCHAR(15), branch VARCHAR(15))
BEGIN
INSERT INTO Testlog(id,user_name,branch)
VALUES(id,user_name,branch);
END$$

DELIMITER ;

我可以在mysql中使用以下命令运行以上存储过程

i can run above stored procedure with below command in mysql

CALL `TestDB`.test123(3,"swap","desc")

但是使用anorm怎么做?

but using anorm how to do that??

DB.withConnection { implicit c =>
SQL("EXCE  test123 {id},{name},{branch}").
on('id -> 22,
'name -> "lcs",
'branch -> "desc").executeQuery()

}

如何在Anorm中运行存储过程

How to run stored procedure in Anorm

推荐答案

这对我有用

SQL("call  test123 ({id},{name},{branch})").
          on('id -> 21,
            'name -> "lcs",
            'branch -> "desc").executeUpdate()

}

这篇关于Anorm Mysql存储过程调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆