How do I tell CodeIgniter ActiveRecord NOT to escape my insert and update queries?
activerecord, codeigniter, codeigniter-2, php
Solution
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')
Problem
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.