Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compressing memo field value
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01417253
Message ID:
01417978
Views:
131
>>>>Hi all
>>>>
>>>>My app is VFP9 on MSSQL database.
>>>>
>>>>I store contents of text files in memo field of a table using APPEND MEMO myfield FROM txtfile OVERWRITE
>>>>
>>>>I need to find out how I can compress a text file so I can store the compressed file into the memo field so that I can improve my app performance when I retrieve data from the table containing the memo field.
>>>>
>>>>Your advice much appreciated
>>>>
>>>>Thanks & Best Regards
>>>
>>>I agree with using the vfpCompression.fll. But from experience I had a few problems. First, the resulting compressed string cannot be writen out to a file directly. It does not have the needed header to allow zip-type application to recognize it. It can only be managed with the utility itself. Second, when we used it excessively, we started to experience C5 errors. There appeared to be a memory leak occuring. Now, with hope, these issues have been addressed in the last few years, and the current version is more stable. Sorry, just speaking from experience.
>>
>>If you can provide me code that reproduces the C5 errors or memory leaks using the latest version of vfpcompression, I would be happy to look into the issues and address them Greg. I am sorry you experienced problems with the library in the past.
>>
>>You are correct about ZipString()/UnzipString() functions not producing zip files. They use zlib's inflate/deflate functions and are designed to work with strings not files. There are plenty of functions in the FLL that deal specifically with files, so there should be no need to create a zip file using the string functions.
>
>I haven't read all the documentation in depth yet, so I just used your first Vector sample
>
>LOCAL lcPlainText
>CLEAR
>SET LIBRARY TO (LOCFILE("vfpencryption71.fll","FLL"))
>lcPlainText = "Nadya Nosonovsky"
>
>*!* F.1 ECB Example Vectors
>*!* F.1.1 ECB-AES128.Encrypt
>m.lcKey = "2b7e151628aed2a6abf7158809cf4f3c"
>?LEN(m.lcKey)
>?STRCONV(m.lcKey,16)
>?decrypt(strconv(encrypt(m.lcPlainText, STRCONV(m.lcKey,16), 0, 0, 0, 16, 16),16),STRCONV(m.lcKey,16), 0, 0, 0, 16, 16)
>
>Got API caused an exception right away. Am I wrong in my test?


Yes. You are using Strconv(,16) on the return value from Encrypt() before sending it to the Decrypt() function. That's wrong because Encrypt doesn't return hex encoded binary. Your line of code should read...
?decrypt(encrypt(m.lcPlainText, STRCONV(m.lcKey,16), 0, 0, 0, 16, 16),STRCONV(m.lcKey,16), 0, 0, 0, 16, 16)
However, your post does highlight the need for better error handling in the FLL. I'm working on that for this FLL and others.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform