Request our suggestio: better way to insert data from Array!string[string] into a database table

Max Haughton maxhaton at gmail.com
Mon Nov 16 18:30:01 UTC 2020


On Monday, 16 November 2020 at 17:44:08 UTC, Vino wrote:
> Hi All,
>
>   Request your suggestion, we have a program which call's an 
> api, the output of the api is parsed using json parser and the 
> result is stored in an array(Array!string[string] data), then 
> these stored result are inserted into MySQL table, for 
> inserting the data into the table we use the below code, this 
> code is a small code which just contains 2 data items 
> (Type,Hostname) and we have similar api's which  contains 15-20 
> data items, hence request your suggestion on is there any 
> better way than the below code, using the below logic the 
> foreach line is will run into multiple lines eg:
>
> [...]

What are you looking to improve? Do you want to make the code 
prettier or faster?

It doesn't look too bad to my eye although my personal style 
would be to unpack t and h inside the foreach loop.


More information about the Digitalmars-d-learn mailing list