iam*_*esy 2 php sql-server activerecord stored-procedures codeigniter
在我的CI应用程序设置中查询mssql数据库.我想执行stored procedure的active record.但我无法掌握任何可靠的文件.
有没有人有任何使用CodeIgniter和/或Active Record传入参数调用存储过程的经验?
谢谢,
比利
wew*_*web 14
是的,请在您的模型中尝试此操作.
$this->db->query("call {storedprocedure function name} ");
Run Code Online (Sandbox Code Playgroud)
如果您在一次调用多个存储过程时遇到问题,则需要添加以下行
/* 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);
}
}
}
Run Code Online (Sandbox Code Playgroud)