[erlang-questions] [HEADS UP] Emysql driver

Mike Oxford moxford@REDACTED
Fri Jul 5 08:35:44 CEST 2013


emysql_util also has some other methods ... as_record/1, as_proplist/1,
as_dict/1
Those will clean up the raw output into something far more
usable/accessible.

-mox

On Thu, Jul 4, 2013 at 2:12 AM, Barco You <barcojie@REDACTED> wrote:

> Where can I find the detailed description about the fields for
> result_packet?
>
> The result_pakcet looks like {result_packet, Number, List1, List2, <<>>},
> and seemingly only List2 is meaningful. Why is there Number, List1 and <<>>
> ?
>
>
> On Thu, Jul 4, 2013 at 4:37 PM, Barco You <barcojie@REDACTED> wrote:
>
>> What is this part as following for?
>>
>>  [{field,2,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"userid">>,<<"userid">>,8,<<>>,63,20,16899,0},
>>                 {field,3,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"name">>,<<"name">>,254,<<>>,33,36,20489,0},
>>                 {field,4,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"id_no">>,<<"id_no">>,254,<<>>,33,54,20481,0},
>>                 {field,5,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"sex">>,<<"sex">>,1,<<>>,63,1,0,0},
>>                 {field,6,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"age">>,<<"age">>,2,<<>>,63,6,0,0},
>>                 {field,7,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"tel">>,<<"tel">>,254,<<>>,33,33,0,0},
>>                 {field,8,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>                        <<"email">>,<<"email">>,253,<<>>,33,132,0,0}],
>>
>>
>> On Thu, Jul 4, 2013 at 4:35 PM, Barco You <barcojie@REDACTED> wrote:
>>
>>> Solved, the bind-address of mhysql should be changed to 0.0.0.0
>>>
>>> But the result packet of emysql:execute looks very verbose and fuzzy.
>>> How can I get only the clean field value or a row, like {field, value} ?
>>>
>>> emysql:execute(db_pool, <<"select * from user where tel =
>>> 13761975289">>).
>>> {result_packet,11,
>>>                [{field,2,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"userid">>,<<"userid">>,8,<<>>,63,20,16899,0},
>>>                 {field,3,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"name">>,<<"name">>,254,<<>>,33,36,20489,0},
>>>                 {field,4,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"id_no">>,<<"id_no">>,254,<<>>,33,54,20481,0},
>>>                 {field,5,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"sex">>,<<"sex">>,1,<<>>,63,1,0,0},
>>>                 {field,6,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"age">>,<<"age">>,2,<<>>,63,6,0,0},
>>>                 {field,7,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"tel">>,<<"tel">>,254,<<>>,33,33,0,0},
>>>                 {field,8,<<"def">>,<<"fangchan">>,<<"user">>,<<"user">>,
>>>                        <<"email">>,<<"email">>,253,<<>>,33,132,0,0}],
>>>                [[1,
>>>                  <<231,138,185,230,157,176>>,
>>>                  <<"237689098736789870">>,1,32,<<"13761975289">>,
>>>                  <<"you.jie@REDACTED">>]],
>>>                <<>>}
>>>
>>>
>>>
>>> On Thu, Jul 4, 2013 at 4:21 PM, Max Lapshin <max.lapshin@REDACTED>wrote:
>>>
>>>> Barco, it means that you need to read manual for mysql server and
>>>> enable socket listener.
>>>>
>>>
>>>
>>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130704/98a7d10f/attachment.htm>


More information about the erlang-questions mailing list