title: Codeigniter db class truncating text on insert
body: <p>I have a codeigniter controller that receives json content from an API and inserts it to a mysql longtext field unchanged.
  Everything's been running smoothly for a while, but recently i've been noticing some of the content is being truncated. Here are two examples.</p>
  
  <p>The table being inserted has three fields</p>
  
  <pre><code>id int 
  data longtext 
  date_added datetime
  </code></pre>
  
  <p>I am receiving the data and directly adding it to the database using the active record insert function. It looks like that</p>
  
  <pre><code>$this-&gt;db-&gt;insert('received', array('data' =&gt; $data, 'date_added' =&gt; date('Y-m-d H:i:s')));
  </code></pre>
  
  <p>Using the profiler, i monitored the queries and found two faulty ones:</p>
  
  <pre><code>INSERT INTO `received` (`data`, `date_added`) VALUES ('{\"status\":{\"lastMaintenanceAt\":0000,\"code\":304,\"period\":900},\"items\":[{\"permalinkUrl\":\"http://example.com\",\"updated\":0000,\"postedTime\":0000,\"summary\":\"Man\'s guarantees are like his words.\",\"title\":\"By: John\",\"content\":\"&lt;p&gt;Man&amp;#8217;s guarantees are like his words.&lt;/p&gt;\",\"id\":\"http://example.com\",\"actor\":{\"permalinkUrl\":\"\",\"displayName\":\"John\"}}],\"title\":\"Comments on: Banker refuses to give ‘Written Guarantee’\"}', '2012-04-08 00:28:29')
  </code></pre>
  
  <p>and</p>
  
  <pre><code>INSERT INTO `received` (`data`, `date_added`) VALUES ('{\"status\":{\"code\":304,\"period\":900,\"feed\":\"http://example.com\"},\"items\":[],\"title\":\"Comments on: Making her cry…\"}', '2012-04-08 00:49:35') 
  </code></pre>
  
  <p>The queries seems alright. But only part of the JSON is making it to the table in the first case, it is truncated after <code>"[...] refuses to give"</code> and in the second after <code>making her cry</code>.</p>
  
  <p>The queries are not returning an error and the date is being inserted properly. Moreover, if i copy the queries and execute them in a mysql command prompt, they will insert the full text.
  These queries a one a few of hundreds of other successful ones.</p>
  
  <p>Any idea what might be the problem?</p>
  
  <p>thank you</p>