Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl Database Entries

by roboticus (Chancellor)
on Jul 14, 2017 at 05:30 UTC ( [id://1195098]=note: print w/replies, xml ) Need Help??


in reply to Perl Database Entries

cbtshare:

If your $api_results is holding a reference to an array of arrays of data like this:

$api_results = [ [ "id1", "app_slug1", "app_name_1", "provider_id_1", ..etc.. ], [ "id2", "app_slug2", "app_name_2", "provider_id_2", ..etc.. ], . . . . . . . . . . . . . . . [ "idN", "app_slugN", "app_name_N", "provider_id_N", ..etc.. ] ];

Then I think what you're looking for is:

# Prepare a handle to an insert statement: $app_insert = $dbh->prepare("INSERT .....blah, blah"); # Fetch each row of data from results while (my $row = shift @$api_results) { # Tell the insert statement to insert the data $app_insert->execute(@$row); } print "Done inserting\n";

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Perl Database Entries
by cbtshare (Monk) on Jul 14, 2017 at 23:48 UTC

    ok, thank you , will try this and get back to you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1195098]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-23 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found