postgresql bytea (blob?)

Jose Damaso rjd318 at gmail.com
Thu May 23 13:22:23 EDT 2013


Thank you so much Bjornke! Your solution worked great and I can now
read the data =)

On 5/21/13, Björnke von Gierke <bvg at mac.com> wrote:
> Hmm maybe "x7" could indicate it's base15? They used to store ascii in that
> encoding, because it's "shorter" then 8 bits (base16)... Nope, it's not
> that, and it'd be (number)x or something like that anyway... fumbling
> around... what if there's a 0 missing at the start (0x is used for octal,
> base16, 8 bit)? Of course!
>
> So what I did was encode the base16 codes to numbers and then chars, in a
> repeat loop (ignoring the x) and in the end i got: "{\rtf1\ansi\a" So that
> looks about right.
>
> Here's the code:
> --
> on mouseUp
>    put "x7b5c727466315c616e73695c616" into theData
>    repeat for each char theChar in char 2 to -1 of theData
>       put theChar after twoChars
>       if the length of twoChars = 2 then
>          put baseconvert(twoChars,16,10) into twoChars
>          put numtochar(twoChars) after theResult
>          put "" into twoChars
>       end if
>    end repeat
>    put theResult -- {\rtf1\ansi\a
> end mouseUp
> --
>
> cheers
> Björnke
>
>
> On 21.05.2013, at 04:11, Jose Damaso wrote:
>
>> Hi - a legacy database at work contains a bytea field that I want to get
>> the information out of. It's rich text that was for whatever reason, was
>> stored as a blob to keep the formatting codes intact -- I'm not even sure
>> what that means since no one here knows much about it and there is no
>> documentation on the system. Does anyone know how to convert the returned
>> query contents of this bytea field to text (or richtext?) with livecode?
>> It
>> looks like this
>>
>> x7b5c727466315c616e73695c616... etc.
>> when my basic query is
>> put "SELECT c.reportnumber, c.reportblob from cases c WHERE c.ID = " &
>> tCaseID into tQuery
>>
>> Thanks!
>>
>> I'm a layer2 guy at work but am planning to use Livecode as my
>> programming
>> gateway drug =)
>
>
> --
>
> Use an alternative Dictionary viewer:
> http://bjoernke.com/bvgdocu/
>
> Chat with other RunRev developers:
> http://bjoernke.com/chatrev/
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list