Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell CodeIgniter ActiveRecord NOT to escape my insert and update queries? [closed]

I need to send some xml that I trust (I wrote it) to my mysql database.

ActiveRecord escapes a lot of my XML. When I pull it out of the database, I am not using CodeIgniter, so I need clean XML in the database.

Thanks in advance.

like image 747
Ted Avatar asked Dec 27 '22 02:12

Ted


1 Answers

Read function set in active record. Below is the snippet from the documentation.

This function enables you to set values for inserts or updates. set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter.

$this->db->set('field', 'field+1', FALSE);
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES (field+1)

$this->db->set('field', 'field+1');
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES ('field+1')
like image 88
Jasonw Avatar answered Feb 02 '23 00:02

Jasonw