Stored Procedures Using CodeIgniter

Can you advise on how to execute a stored procedure using Framework CodeIgniter? I looked through the User Guide and was able to find ways to access the database using queries or ActiveRecords. Appreciate if someone can help as soon as possible.

+2
source share
1 answer

You can use $this->db->query("call my_stored_proc('arg1','arg2');") .

If you have parameters, you should wrap them in a transaction as follows:

 $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; 
+2
source

Source: https://habr.com/ru/post/952966/


All Articles