From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-02-2018 11:58 PM - edited 04-03-2018 12:02 AM
I am thinking about encrypt my SQlite file (without using extension tool) by reading db file as text file (using Read from Text File vi) then encrypt this text content and write back as text file (using Write to Text File vi). By some reason, I cannot access to the table of the db file after decrypting. Because of that reason, I tried is to read db file then rewrite immediately as a new text file. The result is I cannot access to the table anymore (similar to original issue). I tried to use SQLite Studio to access the original file and the new rewrite file. I attach the image of the original and the rewritten text file opened in SQLite Studio. The text content of both files are similar.
Anyone try to do this with successful please give me some advice, otherwise please let me know what wrong with my solution.
Thank you in advance.
Solved! Go to Solution.
04-03-2018 08:53 AM - edited 04-03-2018 08:53 AM
Of course not! A db file is not a text file, so treating it as one will cause trouble. The Read from Text File and Write to Text File does line ending transformation. It is not meant to maintain the binary integrity of a file but the textual integrity, two very different things. Use Read from Binary File and Write to Binary file instead. They will not do line ending transformations!
04-03-2018 09:04 AM - edited 04-03-2018 09:14 AM
Thanks Rolf for replying.
I have just tried to replaced read and write text file with read and write binary file but it still does not work. I tried to read back both files back and compare them either as text or binary and they are all equal. In case of using binary read/write it shows the db file is SQLite ver 2 now.
04-03-2018 10:18 AM
Thanks Rolfk.
What you said is actually correct. I have just made mistake when using read/write binary file incorrectly.
I updated the copy content for future ref.
04-03-2018 10:20 AM
I always thought that you could safely use the text file VIs with binary data if you unchecked the "convert eol" option.
04-03-2018 10:35 AM
Bill,
I just checked but I don't see where to unchecked the "convert eol" option. What vi you talked about?
Regards
04-03-2018 11:04 AM - edited 04-03-2018 11:07 AM
Well, right click on the Read/Write Text File VI and deselect the Convert EOL option.
I'm not sure if disabling this option really is enough, but it sounds anyways wrong to use that if there is a dedicated binary version.
04-03-2018 11:12 AM - edited 04-03-2018 11:16 AM
Maybe we have different definitions of "binary". I think what I actually mean by "binary" is "raw" data. Binary, as it is defined in the Binary file functions, means some kind of structured data that isn't text.
04-03-2018 11:15 AM - edited 04-03-2018 11:15 AM
Rolk,
With this option the compare returns the same but I cannot add the db file to SQLite Studio. Not sure why.
04-03-2018 11:19 AM
@NTT wrote:
Rolk,
With this option the compare returns the same but I cannot add the db file to SQLite Studio. Not sure why.
I would actually suggest trying your old code with the "Convert EOL" option unchecked. It seems to be the easy thing to try.