Browse Source

Support for strings as prepared statement parameters

Sergej Jurecko 9 years ago
parent
commit
91d528fb2e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/mysql_protocol.erl

+ 2 - 0
src/mysql_protocol.erl

@@ -736,6 +736,8 @@ encode_param(null) ->
 encode_param(Value) when is_binary(Value) ->
     EncLength = lenenc_int_encode(byte_size(Value)),
     {<<?TYPE_VAR_STRING, 0>>, <<EncLength/binary, Value/binary>>};
+encode_param(Value) when is_list(Value) ->
+    encode_param(unicode:characters_to_binary(Value));
 encode_param(Value) when is_integer(Value), Value >= 0 ->
     %% We send positive integers with the 'unsigned' flag set.
     if