Announcement

Collapse
No announcement yet.

MySQL Blob Example (Bugged just a little bit)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL Blob Example (Bugged just a little bit)

    Hello Forum users,

    I've created an example on how to store files into a MySQL database and retrieve them. Storing works with small files in my situation. Else it says MySQL server has gone away. The last thing happens when i add files that are bigger then around 900KB. It gives me that errror instantaneously.

    The other bug is when the programm converts the data back to a file with base64encodeto file i taught it was.

    Check it out. and maybe we can get this to work properly. It may come in handy for many users.

    Click image for larger version

Name:	GUI.png
Views:	1
Size:	23.1 KB
ID:	288322

    files_db.zipMySQL BloB example (bugged).apz

  • #2
    In this post I explained that you should use TEXT fields for insertions, as they aren't automatically converted to Base64 encoded strings upon retrieval. If you store the binary data as Base64 in a BLOB field, upon retrieval it would be converted again, which causes an error. Only store binary data in BLOBs, using other tools.
    Sure, there might also be a problem in the plugin somewhere - I am only human - but you are using it incorrectly from the quick glance I had.

    Ulrich

    Comment


    • #3
      Thank you.

      Now i use Longtext to store the base64 string.
      For retrieving the data i use a SELECT query.
      After that i use
      Code:
      row = MySQLCursor:fetch({}, "a");
      And to make it into a file i do
      Code:
      Crypto.Base64EncodeToFile(row.FileData, Name[1], 76)
      Name[1] is a path, filename and extension like it should be. Checked it and it is a valid path.

      The application also crashes when i try to display row.FileData via Dialog.Message. So it's not a problem of Crypto.Base64EncodeToFile.

      Comment


      • #4
        It appears that you may be mixing things. If you are coding with the MySQLCursor, then you are using the LuaSQL module. The conversion of binary (BLOB) data to Base64 encoded strings so it can be handled in AutoPlay Media Studio is available in my MySQL actions plugin. Those are different things. Are you attempting to use both methods to access a MySQL at the same time?


        Ulrich

        Comment


        • #5
          I am not mixing the LuaSQL plugin with your plugin. I only use LuaSQL as it comes with AMS.
          Does your plugin have many advantages against the integrated LuaSQL plugin?

          Comment


          • #6
            You can get the job done with both methods, it is a matter of personal taste. I particularly find that the plugin makes working with the database easier, but your needs and taste may differ.

            I was under the impression that you were using the plugin, when you mentioned that something was being converted to Base64, because this is a built-in feature of the plugin. Maybe I misunderstood.

            The LuaSQL modules were not coded by Indigo Rose, they come from the Kepler Project team. If something does not work as expected, please make sure that you check their documentation for further details, you may find a hint to assist you in finding the issue.

            Ulrich

            Comment

            Working...
            X