从调用codeIgniter的Active Record类的存储过程 [英] Calling a stored procedure from CodeIgniter's Active Record class
本文介绍了从调用codeIgniter的Active Record类的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 CI应用设置来查询 MSSQL
数据库。我想从活动记录
执行存储过程
。但我不能抓住任何固体文档。
In my CI application setup to query a mssql
database. I want to execute a stored procedure
from active record
. But I can't get hold of any solid documentation.
有没有人有任何经验与调用存储的特效与 codeIgniter
和/或活动记录
和传球在参数?
Does anyone have any experience with calling stored procs with CodeIgniter
and/or Active Record
and passing in parameters?
谢谢
比利
推荐答案
是的,试试这个模型中的。
Yes , try this in your model.
$this->db->query("call {storedprocedure function name} ");
如果你遇到麻烦调用超过1存储过程在同一时间,你需要添加下面的行
if you encounter trouble calling more than 1 stored procedure at a time you need to add the following line
/* ADD THIS FUNCTION IN SYSTEM/DATABASE/DB_ACTIVE_REC */
/* USAGE $this->db->freeDBResource($this->db->conn_id); */
function freeDBResource($dbh){
while(mysqli_next_result($dbh)){
if($l_result = mysqli_store_result($dbh)){
mysqli_free_result($l_result);
}
}
}
这篇关于从调用codeIgniter的Active Record类的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文