Hi. One of our customers wants to embedd an PDF file in an EHF Invoice XML file. And they need it to be BASE64 encoded. So I've read the file into a blob and are trying to encode it using SQL Anywhere 16's builtin base64_encode(string) function. The PDF file is 92344 bytes, and the blob has that length after this command (PowerBuilder code):
Then I try to base64 encode it using this command:
The command executes without error, but the string containing the BASE64 encoded PDF is only 32767 bytes, and should be closer to 120.000 (due to some overhead in the BASE64 encoding). The VARCHAR datatype in SQL Anywhere is 32767 long, but the base64_encode() function is supposed to return a long varchar string, which is approx 2 GB in size. (I've also tried to insert the data into a #temp table, but the the encoded string is still only 32767). Can anyone see if there is something I'm doing wrong?
Or if there is another approach to solving this issue?
I've looked into running |
I'm not a PowerBuilder user but a quick google search pointed me to this post that indicates that PowerBuilder has a limit of 32K when fetching strings. You need to fetch the result using "select blob" (whatever that means?) HTH 3
The commands SELECTBLOB and UPDATEBLOB are PowerBuilder embedded SQL that manipulate data that is 32k or larger interacting with the database. I believe that both UPDATEBLOB and SELECTBLOB with an intermediate table in SA will be needed to solve this.
(06 Jan '17, 16:07)
Chris Keating
SELECTBLOB works like a charm. The base64 encoded file matches the files I get from several online base64 encoders. Thanks a lot! Bjarne
(09 Jan '17, 07:00)
Bjarne Anker
Replies hidden
I'd like to see the file that has different base64 presentations :)
(09 Jan '17, 07:12)
Vlad
|