_queries = get_data_query_array($data_source['snmp_query_id']);      /* get the host override fields */     $data_template_id = db_fetch_cell_prepared('SELECT ' . SQL_NO_CACHE . ' data_template_id      FROM data_template_data      WHERE local_data_id = ?',      array($data_source['id']));      /* get host fields first */     $host_fields = array_rekey(      db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' dif.type_code, did.value       FROM data_input_fields AS dif       LEFT JOIN data_input_data AS did       ON dif.id=did.data_input_field_id       WHERE (type_code LIKE "snmp_%" OR type_code="hostname")       AND did.data_template_data_id = ?       AND did.value != ""', array($data_input['data_template_data_id'])),      'type_code', 'value'     );      $data_template_fields = array_rekey(      db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' dif.type_code, did.value       FROM data_input_fields AS dif       LEFT JOIN data_input_data AS did       ON dif.id=did.data_input_field_id       WHERE (type_code LIKE "snmp_%" OR type_code="hostname")       AND data_template_data_id = ?       AND did.data_template_data_id = ?       AND did.value != ""', array($data_template_id, $data_template_id)),      'type_code', 'value'     );      if (cacti_sizeof($host_fields)) {      if (cacti_sizeof($data_template_fields)) {       foreach ($data_template_fields as $key => $value) {        if (!isset($host_fields[$key])) {         $host_fields[$key] = $value;        }       }      }     } elseif (cacti_sizeof($data_template_fields)) {      $host_fields = $data_template_fields;     }      if (cacti_sizeof($outputs) && cacti_sizeof($s