CodeIgniter Forums
Escaped values - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Escaped values (/thread-56377.html)



Escaped values - El Forum - 12-14-2012

[eluser]Unknown[/eluser]
Hi,

I am trying to use the MySQL AES_ENCRYPT function with Datamapper ORM. The trouble is when I use this code the generated insert statement is a string rather an SQL function:
Code:
$d->supplier = $d->func('AES_ENCRYPT','Name', '@897sdn9j98u98jk');

It generates an insert statement like this:

Code:
INSERT INTO `deals` (`name`, `supplier`, `customer`, `period`, `minimumreturn`) VALUES
('Test_Case_411', 'AES_ENCRYPT(\'Name\', `897sdn9j98u98jk`)', 'Cust', '36', '10')

with the AES_ENCRYPT function in quotations.

The statement I need should look like this:

Code:
INSERT INTO `deals` (`name`, `supplier`, `customer`, `period`, `minimumreturn`) VALUES
('Test_Case_411', AES_ENCRYPT(\'Name\', `897sdn9j98u98jk`), 'Cust', '36', '10')

Does anyone now how I can achieve this?

Thanks.