尝试使用CodeIgniter“调用”存储过程 [英] Trying to 'call' stored procedures with CodeIgniter

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

问题描述

我有这个工作代码与CI:

  $ this-> db-> query(call nameOfProcedure ('param1',@ param2)); 
$ query = $ this-> db-> query('SELECT @ param2 as results');
$ row = $ query-> row();

它可以工作,但如果我尝试使用:

  $ this-> db-> call_function('nameOfProcedure','param1','@ param2'); 

我得到错误:


此功能不适用于您使用的数据库。


b
$ b

感谢

解决方案

查看 call_function 上的com / user_guide / database / call_function.htmlrel =nofollow> docs



您可以检查 call_function

/ code>代码在 /system/database/DB_driver.php Ln 998在CI 2.1.0看清楚它在做什么。


i've this working code with CI:

$this->db->query("call nameOfProcedure('param1', @param2)");
$query = $this->db->query('SELECT @param2 as results');
$row = $query->row();

it works, but if I try to use:

$this->db->call_function('nameOfProcedure', 'param1', '@param2');

i get the error:

This feature is not available for the database you are using.

What's wrong exactly?

Thanks

解决方案

Check out the docs on call_function. It's for calling functions that aren't native to CI's DB driver, not for calling procedures you've written.

You can check the call_function code in /system/database/DB_driver.php Ln 998 on CI 2.1.0 to see clearly what it's doing.

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

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