Search Postgresql Archives

Re: Equivalent of PHP "hex2bin()"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



to_hex() takes in integer or bigint and returns a hexadecimal string equivalent. But there is also, perhaps better, encode() and decode() which convert string to either base64, hex, or "escape" codes.


On Fri, Dec 19, 2014 at 2:38 PM, Stephen Cook <sclists@xxxxxxxxx> wrote:
PHP has functions "bin2hex()" and "hex2bin()", and I have to deal with the results in PostgreSQL.

These functions "Returns an ASCII string containing the hexadecimal representation of str. The conversion is done byte-wise with the high-nibble first" and "Decodes a hexadecimally encoded binary string". Basically you can take binary data and each byte becomes two hexadecimal characters.

Is there anything in PostgreSQL that can do this already? I'm sure I can work it out but it can't hurt to ask first.

-- Stephen



--
While a transcendent vocabulary is laudable, one must be eternally careful so that the calculated objective of communication does not become ensconced in obscurity.  In other words, eschew obfuscation.

111,111,111 x 111,111,111 = 12,345,678,987,654,321

Maranatha! <><
John McKown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux