178 # Build the first half of the INSERT 179 # using the field list we got from the earlier DESCRIBE 180 # Of course we only do this if we have any rows to insert 181 if ($affected_rows) { 182 my $base_insert = "INSERT IGNORE INTO $thisTable (hostname, host_id, " 183 . join("," , @fields) 184 . ") VALUES (\"$site_hostname\", \"$site_id\", "; 185 186 # Now we iterate through the result set from the previous query 187 # completing each INSERT as we go, and dumping them all into a big list 188 while (my @row = $dbq->fetchrow_array) { 189 # Need to check for NULL's 190 for(@row) { $_ = "NULL" if !defined $_; } 191 my $this_insert = $base_insert 192 . join("," , map {qq("$_")} @row) 193 . ");"; 194 push @central_inserts, $this_insert; 195 } 196 }