Re: Equivalent of PHP "hex2bin()"

Поиск
Список
Период
Сортировка
От John McKown
Тема Re: Equivalent of PHP "hex2bin()"
Дата
Msg-id CAAJSdjiiWLjX-Y50KvDb2DGQjfXxnsr_C_u4R2e2BhzG1UErTg@mail.gmail.com
обсуждение исходный текст
Ответ на Equivalent of PHP "hex2bin()"  (Stephen Cook <sclists@gmail.com>)
Список pgsql-general
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@gmail.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Cook
Дата:
Сообщение: Equivalent of PHP "hex2bin()"
Следующее
От: Arup Rakshit
Дата:
Сообщение: Re: Uninstall Postgresql in openSUSE 13.1