|
-
Jan 17th, 2024, 01:21 PM
#7
Addicted Member
Re: RC6 SQLite - how to store/read a LONG-Array?
 Originally Posted by Schmidt
It could (when you pass it the Pointer to the first member - and the right ByteLen)...
But generally, when you deal with Blobs, you deal with ByteArrays.
So, what you'll get back (in a Recordset) when you read it out later, will be a ByteArray.
The question boils down to:
"How to serialize/deserialize a VB-LongArr to/from a VB-ByteArray?"
In case these LongArrays only contain a handful of Fields, I'd store them joined in a String.
Here's a OneLiner for the IDE-ImmediateWindow, which shows an easy way to do this:
?New_c.ArrayList(vbLong, Array(1,2,3)).Join(",")
In your code you'd just replace the blue marked part with your Long-Array-Variable.
HTH
Olaf
Thanks a TON again, Olaf.
But, what if I wish to store the byte array as string itself (in a TEXT field, say 'ts')? I tried but could not succeed.
I thought it might be to do with the database's encoding. So, before creating the table, I executed "pragma encoding='utf-16le'" in the connection. But, the string stored in 'ts' was always different from what was set to it.
So, how to store a UTF-16 string in TEXT field correctly, if at all it can be done? Kindly let me know.
If it cannot be done and BLOB only should be used, then what exactly is the purpose of setting the encoding using pragma to utf-8 or utf-16? Kindly educate me.
Ever in Gratitude.
Kind Regards.
Love is God . God is Love
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|