Module helper_common

Utility functions.

Copyright © 2010-2014 Alexei Krasnopolski

Version: 1.2.8

Introduced in: 2011-04-25

Authors: Alexei Krasnopolski (krasnop@bellsouth.net) [web site: http://krasnopolski.org/].

Description

Utility functions.

Function Index

reverse_binary/1Reverses an order of bytes in Binary.
status_to_string/1Generates string representation of MySQL server status.
server_status_to_record/1Parses binary to server status record.
client_flags_record_to_binary/1Generates binary from client flags record.
binary_to_client_flags_record/2Extracts #client_options{} record from Binary.
type_to_atom/1Converts integer constants represent MySQL types to atoms.
parse_data_flags/1Generates list of atoms these represent MySQL data flags are set.
extract_length_coded_integer/1Extracts lenght coded integer from binary and returns a tuple that contains a value of extracted integer and rest of binary.
extract_length_coded/2Extracts lenght coded binary/string from binary stream and returns a tuple that contains an extracted binary/string and rest of original binary.
binary_to_datetime/1Converts SQL Datetime value represented as binary to record mysql_time.
integer_to_length_coded_binary/1Converts integer value to MySQL binary format.
binary_to_length_coded_binary/1Converts Erlang binary value to MySQL binary format.
string_to_length_coded_binary/1Converts Erlang string to MySQL binary format.
decimal_to_lc_binary/1Converts Erlang mysql_decimal record to MySQL binary format.
datetime_to_lc_binary/1Converts Erlang mysql_time record to MySQL datetime binary format.
date_to_lc_binary/1Converts Erlang mysql_time record to MySQL date binary format.
time_to_lc_binary/1Converts Erlang mysql_time record to MySQL time binary format.
atom_list_to_string/1Converts list of atoms to a string that contains string representation of the atoms separated by comma.

Function Details

reverse_binary/1

reverse_binary(Binary::binary()) -> binary()

Reverses an order of bytes in Binary.

status_to_string/1

status_to_string(Server_status::#server_status{}) -> string()

Generates string representation of MySQL server status.

server_status_to_record/1

server_status_to_record(Binary::binary()) -> #server_status{}

Parses binary to server status record.

client_flags_record_to_binary/1

client_flags_record_to_binary(ClientFlags::#client_options{}) -> binary()

Generates binary from client flags record.

binary_to_client_flags_record/2

binary_to_client_flags_record(Lang::integer(), Binary::binary()) -> #client_options{}

Extracts #client_options{} record from Binary.

type_to_atom/1

type_to_atom(MySQL_Type::integer()) -> atom()

Converts integer constants represent MySQL types to atoms.

parse_data_flags/1

parse_data_flags(Binary::binary()) -> [atom()]

Generates list of atoms these represent MySQL data flags are set.

extract_length_coded_integer/1

extract_length_coded_integer(Binary::binary()) -> {Value::integer(), Rest_of_binary::binary()}

Extracts lenght coded integer from binary and returns a tuple that contains a value of extracted integer and rest of binary.

extract_length_coded/2

extract_length_coded(Is_binary::boolean(), Binary::binary()) -> {Value::term(), Rest_of_binary::binary()}

Extracts lenght coded binary/string from binary stream and returns a tuple that contains an extracted binary/string and rest of original binary.

binary_to_datetime/1

binary_to_datetime(Binary::binary()) -> {#mysql_time{}, binary()}

Converts SQL Datetime value represented as binary to record mysql_time.

integer_to_length_coded_binary/1

integer_to_length_coded_binary(Value::integer()) -> binary() | #mysql_error{}

Converts integer value to MySQL binary format

binary_to_length_coded_binary/1

binary_to_length_coded_binary(Value::binary()) -> binary()

Converts Erlang binary value to MySQL binary format

string_to_length_coded_binary/1

string_to_length_coded_binary(Value::string()) -> binary()

Converts Erlang string to MySQL binary format

decimal_to_lc_binary/1

decimal_to_lc_binary(Value::#mysql_decimal{}) -> binary()

Converts Erlang mysql_decimal record to MySQL binary format

datetime_to_lc_binary/1

datetime_to_lc_binary(Value::#mysql_time{}) -> binary()

Converts Erlang mysql_time record to MySQL datetime binary format

date_to_lc_binary/1

date_to_lc_binary(Value::#mysql_time{}) -> binary()

Converts Erlang mysql_time record to MySQL date binary format

time_to_lc_binary/1

time_to_lc_binary(Value::#mysql_time{}) -> binary()

Converts Erlang mysql_time record to MySQL time binary format

atom_list_to_string/1

atom_list_to_string(Atoms::list()) -> string()

Converts list of atoms to a string that contains string representation of the atoms separated by comma.


Generated by EDoc