在我的 CI 应用程序 设置中查询 mssql
数据库。我想从 active record
执行一个存储过程
。但我无法获得任何可靠的文档。
有没有人有使用 CodeIgniter
和/或 Active Record
调用存储过程并传入参数的经验?
谢谢,
比利
最佳答案
是的,在你的模型中试试这个。
$this->db->query("call {storedprocedure function name} ");
如果您在一次调用超过 1 个存储过程时遇到问题,您需要添加以下行
/* 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);
}
}
}
关于php - 从 CodeIgniter Active Record 类调用存储过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4827752/