static function batch_add($exhibit_id, $address_field, $datum_ids, $addresses) { /* * Delete everything that isn't one of datum_ids and is associated with exhibit_id,address_field */ $table = WpExhibitConfig::table_name(WpExhibitConfig::$GEOCODE_TABLE_KEY); global $wpdb; // Prepare the list of things they're asking about $list_of_ids = array(); for ($i = 0; $i < count($datum_ids); $i++) { $list_of_ids[$i] = $wpdb->prepare("%s", $datum_ids[$i]); } $theList = join(", ", $list_of_ids); $sql = "DELETE FROM {$table} WHERE exhibit_id = %d AND addressField = %s AND datum_id NOT IN ({$theList});"; $query = $wpdb->prepare($sql, $exhibit_id, $address_field); $row = $wpdb->query($query); if (count($datum_ids) == count($addresses)) { for ($i = 0; $i < count($datum_ids); $i++) { WpExhibitGeocoder::lookup($exhibit_id, $address_field, $datum_ids[$i], $addresses[$i]); } return true; } else { return false; } }