Guest_imported
New member
- Jan 1, 1970
- 0
I have a long string of 15,000 characters. Rather than save this to the MySQL DB, I have a VB routine which uses ZLib compression to compact it down to 1,000 (approx) bytes. My problem is, is that the compression result is NOT an ascii character string, but raw binary data. How can I save this to the MySQL DB?
If I compress it to a string...
Dim str as String
str = CompressToString(strLongString)
... then the SQL Insert statement doesn't work. I believe it's because it must have some strange characters that distrupt the SQL string since I can't even display the "str" variable fully to a textbox. So after doing some research, I found that maybe I need to compress it to a Byte array (which holds raw binary data) and insert that into a BLOB field type. So at this point, I've got the array with...
Dim ByteArray() As Byte
ByteArray = CompressToByteArray(strLongString)
... however, I can't figure out the SQL query syntax necessary for inserting this Byte Array into the BLOB field in the MySQL DB. (Much less retrieve it, which I need to do also). So can anyone tell me if I'm on the right track? If so, how can I insert that ByteArray into the DB?
If anyone can help me out, I'll buy you a Porshe. Well, OK, maybe not since I can only afford a Taurus, but you'll have the satisfaction of being my new hero if you can help me out with this!
If I compress it to a string...
Dim str as String
str = CompressToString(strLongString)
... then the SQL Insert statement doesn't work. I believe it's because it must have some strange characters that distrupt the SQL string since I can't even display the "str" variable fully to a textbox. So after doing some research, I found that maybe I need to compress it to a Byte array (which holds raw binary data) and insert that into a BLOB field type. So at this point, I've got the array with...
Dim ByteArray() As Byte
ByteArray = CompressToByteArray(strLongString)
... however, I can't figure out the SQL query syntax necessary for inserting this Byte Array into the BLOB field in the MySQL DB. (Much less retrieve it, which I need to do also). So can anyone tell me if I'm on the right track? If so, how can I insert that ByteArray into the DB?
If anyone can help me out, I'll buy you a Porshe. Well, OK, maybe not since I can only afford a Taurus, but you'll have the satisfaction of being my new hero if you can help me out with this!