MySqlBackup.Net icon indicating copy to clipboard operation
MySqlBackup.Net copied to clipboard

Help needed - Unable to export BLOB in Char Format

Open adriancs2 opened this issue 6 years ago • 1 comments
trafficstars

Hi developers/programmers,

Currently, MySqlBackup.NET only able to export BLOB field into HexString, which works fine. But however, I would like to provide another optional function: Export the BLOB field into binary char format, which is what MySqlDump does.

However, due to some unknown reason or missing steps, I'm unable to export the BLOB into char properly, which results altering of original bytes of the BLOB data.

Take this table as example:

CREATE TABLE `tableblob` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `blobdata` MEDIUMBLOB,
  PRIMARY KEY (`id`)
)
ENGINE = InnoDB;

I am able to extract the BLOB from database and write it as follow:

blobexport

But, however, after the blob data was re-select out from database, the blob seems to be corrupted.

Any help would be appreciated.

I have attached the a sample project that specially built for running the test of this. You may use this project to perform the testing/debugging as well.

blob_debug.zip

You may look into the following files which the conversion of blob takes place: \blob_debug\blob_debug\MySqlBackup.NET v2.3\Methods\QueryExpress.cs

Line 175: public static string ConvertToSqlFormat
Line 202: else if (ob is System.Byte[])

Thank you!

===================== Related issue: https://github.com/MySqlBackupNET/MySqlBackup.Net/issues/5

adriancs2 avatar Jun 24 '19 14:06 adriancs2

I'm not sure how this is supposed to work, as it makes no sense to do it that way. Depending how the sql file is read later, encoding will break it.

Memnarch avatar Feb 01 '21 17:02 Memnarch