List:Internals« Previous MessageNext Message »
From:Zardosht Kasheff Date:May 5 2013 3:53pm
Subject:outputting varchars to a file to be read by load data infile
View as plain text  
Hello all,

I have an interesting problem. I am in the process of trying to
manually recover data from a corrupted dictionary. The table has
DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci, and there are four
columns:
  `a` varchar(100) CHARACTER SET utf8 NOT NULL,
  `b` varchar(10) COLLATE latin1_general_ci DEFAULT NULL,
  `c` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
  `d` varchar(20) COLLATE latin1_general_ci NOT NULL DEFAULT '',

The data in the corrupted dictionary is identical to what we would
find in table->record[0] as accessed by storage engine's handler. It
contains the length of each string and the bytes.

What I want to do is make a little program that will read this data
from the corrupted dictionary, and write it to a file in such a format
such that I can use "load data infile" to interpret it correctly and
reload the data.

If I just copy the bytes directly to the file, will load data infile
be able to interpret the data? Is there anything else that needs to be
done (such as put in a \0 or something?)

Thanks
-Zardosht
Thread
outputting varchars to a file to be read by load data infileZardosht Kasheff5 May