Inserting a file into Mysql (using delphi)

Help
2004-10-02
2013-04-02
  • Nobody/Anonymous

    How can I insert a file (image, zip file, etc..) into mysql.

     
    • Nobody/Anonymous

      Is this not currently possible with Direct MySQL Objects?

       
    • Nobody/Anonymous

      you can use TFileStream (delphi) and use longblob fields in tables.

       
    • Nobody/Anonymous

      but using Direct SQL how do you do it?  All I see is a query method, but nothing that will allow me to use a stream.

       
    • Nobody/Anonymous

      try to save the stream to the string and then send this string as a value for some field in yours table. Works with txt 100% correctly. now i have some problems with mp3 file sending. I open mp3's like binary file into a string. I think, that the string from Filestream contains some symbols (like 'end of string' symbol)
      and thatway mysql report about some error in the string with this string.
      <m-tropolis@mailcity.com>.

       
    • Nobody/Anonymous

      This question seems to come back over and over again .. i will create a small sample tonight and will post it on sourceforge tomorrow.

      The binrary values needs to be escaped (see helpers unit), before sending it's value to the server.

      Kind regards,
      Cristian Nicola

       
    • Cristian Nicola

      Cristian Nicola - 2004-11-30

      Have a look at MysqlStreams in the 3rd party package. Demo project included.

      http://prdownloads.sourceforge.net/directsql/MysqlStreams.zip?download

      Regards,
      Cristian Nicola

       
    • Nobody/Anonymous

      m-tropolis> thanx a lot. Cristian.
      realy greate work - your library.
      :-))

       
    • Nobody/Anonymous

      The query is limited to 1 MB?
      I try with the demo of MysqlStreams and if I choose a picture with size < 1Mb it works fine, but if picture's size > 1 Mb, the query is not executed.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks