title: Delphi - Saving TStringStream to SQL
body: <p>I am using Embarcadero Delphi XE2</p>
  
  <p>I'm creating a fastreport (its not that important) and saving it to TStringStream</p>
  
  <p>Next just for tests I output that TStringStream to file, and the PDF saves fine and opens fine. It weights about 40KB (less)</p>
  
  <p>What I need to do next, is write this PDF (TStringStream) to SQL database through INSERT, the only thing I do to modify it is I replace all " with "" because its within " quotes, otherwise the SQL doesn't work.</p>
  
  <p>The strange thing is, when I load the file from database, or even to SELECT length(attachment) where the attachment is PDF data saved earlier. When I do that, the size is more than 50KB (for some PDF's even about 70KB), and the PDF is whole blank.</p>
  
  <p>I am forced to use a simple mysql unit for this project which doesn't allow some setParams or saving it through Blob object which I googled. So I need an answer concerning this simple method. Insert TStringStream to SQL database.</p>
  
  <p>The database field is type MEDIUMBLOB</p>
  
  <p>Thanks in advance!</p>
  
  <p>Jack</p>