Welcome Guest, Not a member yet? Register   Sign In
Save JSON string (PDO) into a SQLLite DB....duplicates!
#1

Ok, i tried to google this. And it took my hours to find this horrible "bug" or feature (PDO prepare?).

So i am using SQLLite as my dev db and Codeigniter 2.2.0.

The driver i am using is PDO.

When i try to save a JSON string in SQLLite that haves the word "select" in it it will save the post 2 times. So this will make dublicate inserts:
PHP Code:
$data = array(
                
'mData' => '{"select77":"korre"}',
                
'mTablet' => 12,
                
'mComponenttype' => 12,
                
'mDatahash' => '',
                
'mObject' => 11
);
$qinsert $this->db->insert('component_content'$data); 

This will not:
PHP Code:
$data = array(
                
'mData' => '{"selek77":"korre"}',
                
'mTablet' => 12,
                
'mComponenttype' => 12,
                
'mDatahash' => '',
                
'mObject' => 11
);
$qinsert $this->db->insert('component_content'$data); 

Notice i changed mData to selek77 instead of select77.

Why? Is this some "nice" PDO.prepare stuff? What can i do? It is not an option to update to CI 3 right now (for various reasons).
Reply


Messages In This Thread
Save JSON string (PDO) into a SQLLite DB....duplicates! - by Jacker - 04-07-2015, 07:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB