如果参数是数组变量,如何在codeigniter模型中调用存储过程?

Controller file.

public function insert()
  {
    $data = array(
      'vndr_name' => $this->input->post('vndr_name'),
      'vndr_phone' => $this->input->post('vndr_phone'),
      'vndr_mobile' => $this->input->post('vndr_mobile'),
      'vndr_gst' => $this->input->post('vndr_GST'),
      'vndr_pan' => $this->input->post('vndr_PAN'),
      'vndr_addressLine1' => $this->input->post('vndr_addr_line1'),
      'vndr_addressLine2' => $this->input->post('vndr_addr_line2'),
      'vndr_city' => $this->input->post('vndr_city'),
      'vndr_state' => $this->input->post('vndr_state'),
      'vndr_zipcode' => $this->input->post('vndr_ZIP'),
      'vndr_enrldate' => $this->input->post('enrlmnt_date')
    );
    $udata = $this->Vendor_model->insert($data);
    //print_r($udata);
    if($udata !== 0)
    {
      //print_r("$udata");
      echo 'success';
      exit;
    }
    else
    {
      echo 'failed';
      exit;
    }
  }

model file I have not used the OUT parameter since I am trying to insert the values first. Is there any other alternative way for calling stored procedure if the parameter is array variable.

class Vendor_model extends CI_Model {

  public function insert($id)
  {
    //$this->db->query("CALL sp_select_vendor()");
    //$userlevel = $this->db->insert('tbl_Vendor', $id);
    $userlevel= $this->db->query("CALL sp_insert_vendor()");

    return $userlevel;
    if($userlevel->num_rows() > 0)
    {
      $row = $userlevel->row();
      return $row;
    }
    else
    {
      return $userlevel->num_rows();
    }
  }

Stored procedure file

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_insert_vendor`(IN vname LONGTEXT, IN vphone LONGTEXT, IN vmobile LONGTEXT, IN vgst LONGTEXT, IN vpan LONGTEXT, IN vadd1 LONGTEXT, IN vadd2 LONGTEXT, IN vcity LONGTEXT, IN vstate LONGTEXT, IN vzip LONGTEXT, IN vedate LONGTEXT)
BEGIN
INSERT INTO tbl_Vendor (vndr_name,vndr_phone,vndr_mobile,vndr_gst,vndr_pan,vndr_addressLine1, vndr_addressLine2, vndr_city, vndr_state,vndr_zipcode, vndr_enrldate) VALUES (vname,vphone,vmobile,vgst, vpan,vadd1,vadd2,vcity, vstate, vzip, vedate);
END$$
DELIMITER ;

Well... You can $this->db->escape() them before and parse string.

$data = array(
      'vndr_name' => $this->input->post('vndr_name'),
      'vndr_phone' => $this->input->post('vndr_phone'),
      'vndr_mobile' => $this->input->post('vndr_mobile'),
      'vndr_gst' => $this->input->post('vndr_GST'),
      'vndr_pan' => $this->input->post('vndr_PAN'),
      'vndr_addressLine1' => $this->input->post('vndr_addr_line1'),
      'vndr_addressLine2' => $this->input->post('vndr_addr_line2'),
      'vndr_city' => $this->input->post('vndr_city'),
      'vndr_state' => $this->input->post('vndr_state'),
      'vndr_zipcode' => $this->input->post('vndr_ZIP'),
      'vndr_enrldate' => $this->input->post('enrlmnt_date')
    );
foreach(array_keys($data) as $h)
    $arr_cols[$h] = $this->db->escape($arr_cols[$h]);

$str_cols = implode(', ', $arr_cols);

$this->db->query("CALL sp_insert_vendor({$str_cols})");