Skip to content

Instantly share code, notes, and snippets.

@nox
Created October 4, 2010 16:21
Show Gist options
  • Save nox/609977 to your computer and use it in GitHub Desktop.
Save nox/609977 to your computer and use it in GitHub Desktop.
length_coded_binary(<<Length/little, Bin:Length/binary, Rest/binary>>) when Length =< 250 ->
{Bin, Rest};
length_coded_binary(<<252/little, Length:16/little, Bin:Length/binary, Rest/binary>>) ->
{Bin, Rest};
length_coded_binary(<<253/little, Length:24/little, Bin:Length/binary, Rest/binary>>) ->
{Bin, Rest};
length_coded_binary(<<254/little, Length:64/little, Bin:Length/binary, Rest/binary>>) ->
{Bin, Rest}.
column_value(<<251/little, Rest/binary>>) ->
{null, Rest};
column_value(Bin) ->
length_coded_binary(Bin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment