【发布时间】:2012-01-19 15:31:26
【问题描述】:
您能否就如何使用 CodeIgniter 框架执行存储过程提供建议?我查看了用户指南,只能找到使用查询或 ActiveRecords 访问数据库的方法。不胜感激,如果有人能尽早提供帮助。
【问题讨论】:
标签: php codeigniter activerecord stored-procedures
您能否就如何使用 CodeIgniter 框架执行存储过程提供建议?我查看了用户指南,只能找到使用查询或 ActiveRecords 访问数据库的方法。不胜感激,如果有人能尽早提供帮助。
【问题讨论】:
标签: php codeigniter activerecord stored-procedures
您可以使用$this->db->query("call my_stored_proc('arg1','arg2');")。
如果您有 out 参数,则必须将其包装在事务中,如下所示:
$this->load->database();
$this->db->trans_start();
$success = $this->db->query("call my_stored_proc('arg1','arg2',@out_param);");
$out_param_query = $this->db->query('select @out_param as out_param;');
$this->db->trans_complete();
$out_param_row = $this->db->row();
$out_param_val = $this->out_param;
【讨论】:
mysqli_query而不是mysqli_multi_query