[erlang-questions] How to convert sql return data to json

Palanikumar Gopalakrishnan <>
Tue Sep 5 13:32:16 CEST 2017


Hi Kenneth,

                    Thanks for your reply, I already include the*
-include_lib("erlmysql/**include/client_records.hrl").  *in my source

On 5 September 2017 at 02:29, Kenneth Lakin <> wrote:

> On 09/01/2017 05:36 AM, Palanikumar Gopalakrishnan wrote:
> > *for checking Sql result {{metadata,2,0,
> > {server_status,false,true,false,false,true,
> > false,false,false,false,false,false,false},
> > [{field_metadata,"def","zurik","erlang",
> > "erlang","name","name",33,135,253,
> > <<0,0>>,0,[]},
> > {field_metadata,"def","zurik","erlang",
> > "erlang","id","id",63,11,3,
> > <<0,0>>,0,[]}],[]},
> > [["some",457],["some",457],["data2sosfasfme",42]]}*
>
> So, it *looks* like your driver is returning a tuple containing:
> * A 'metadata' record which contains (among other things) a
> server_status record and a list of field_metadata records.
> * A list containing the data that is the response to your query.
>
> The "Getting Started" section of the erlmysql documentation [0] seems to
> say that the record definitions that you need are contained in
> "client_records.hrl". Loading that file into your Erlang shell with the
> rr/1 shell command and re-running the query should make the SQL driver's
> return value make more sense to you.
>
> In order to load those record definitions into your client code, you'll
> probably need to do something like
>
> -include_lib("erlmysql/include/client_records.hrl").
>
> near the top of the file that needs to interact with the SQL driver.
>
> [0] http://erlmysql.sourceforge.net/
>
>


-- 

*Warm Regards,*

*Palanikumar Gopalakrishnan *[image: ✌]
*Developer*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170905/524c4c54/attachment.html>


More information about the erlang-questions mailing list