Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 30, 2017 Convert ResultSet to List of Associted Array | ||||
---|---|---|---|---|
| ||||
Hi I am new to D writing a web service with vibe. My webservice connect to mysql and return the result as JSON. How do I convert resultset to Array of Associated Array [["col1" : value, "col2" : value], ....] |
July 30, 2017 Re: Convert ResultSet to List of Associted Array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jshah | On Sunday, 30 July 2017 at 16:39:05 UTC, Jshah wrote:
> Hi
>
> I am new to D writing a web service with vibe.
>
> My webservice connect to mysql and return the result
> as JSON.
>
> How do I convert resultset to Array of Associated Array
> [["col1" : value, "col2" : value], ....]
I am using mysql-native
|
August 01, 2017 Re: Convert ResultSet to List of Associted Array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jshah | On 7/30/17 1:02 PM, Jshah wrote: > On Sunday, 30 July 2017 at 16:39:05 UTC, Jshah wrote: >> Hi >> >> I am new to D writing a web service with vibe. >> >> My webservice connect to mysql and return the result >> as JSON. >> >> How do I convert resultset to Array of Associated Array >> [["col1" : value, "col2" : value], ....] > > I am using mysql-native Variant[string][] realresult; realresult.reserve(resultset.length); while(!resultset.empty) { realresult ~= resultset.asAA; } -Steve |
August 01, 2017 Re: Convert ResultSet to List of Associted Array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 8/1/17 10:14 AM, Steven Schveighoffer wrote: > On 7/30/17 1:02 PM, Jshah wrote: >> On Sunday, 30 July 2017 at 16:39:05 UTC, Jshah wrote: >>> Hi >>> >>> I am new to D writing a web service with vibe. >>> >>> My webservice connect to mysql and return the result >>> as JSON. >>> >>> How do I convert resultset to Array of Associated Array >>> [["col1" : value, "col2" : value], ....] >> >> I am using mysql-native > > Variant[string][] realresult; > realresult.reserve(resultset.length); > while(!resultset.empty) > { > realresult ~= resultset.asAA; resultset.popFront(); // forgot this. > } > -Steve |
August 01, 2017 Re: Convert ResultSet to List of Associted Array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 1 August 2017 at 14:14:57 UTC, Steven Schveighoffer wrote:
> On 8/1/17 10:14 AM, Steven Schveighoffer wrote:
>> On 7/30/17 1:02 PM, Jshah wrote:
>>> On Sunday, 30 July 2017 at 16:39:05 UTC, Jshah wrote:
>>>> Hi
>>>>
>>>> I am new to D writing a web service with vibe.
>>>>
>>>> My webservice connect to mysql and return the result
>>>> as JSON.
>>>>
>>>> How do I convert resultset to Array of Associated Array
>>>> [["col1" : value, "col2" : value], ....]
>>>
>>> I am using mysql-native
>>
>> Variant[string][] realresult;
>> realresult.reserve(resultset.length);
>> while(!resultset.empty)
>> {
>> realresult ~= resultset.asAA;
>
> resultset.popFront(); // forgot this.
>> }
>>
>
> -Steve
Thanks It is working
|
Copyright © 1999-2021 by the D Language Foundation