Unverified Commit 074e735c authored by Kevin Duret's avatar Kevin Duret Committed by GitHub
Browse files

Update generateSqlLite

parent e8673cba
...@@ -395,20 +395,24 @@ try { ...@@ -395,20 +395,24 @@ try {
} }
// Insert direct services // Insert direct services
$insertedHostServiceRelation = array(); $insertedHostServiceRelation = [];
$insertedServices = array(); $insertedServices = [];
foreach ($result_host_services as $value) { foreach ($result_host_services as $value) {
if (!isset($insertedHostServiceRelation[$value['service_id'] . "-" . $value['host_id']])) { if (!isset($insertedHostServiceRelation[$value['service_id'] . "-" . $value['host_id']])) {
if (!isset($insertedServices[$value['service_id']])) { if (!isset($insertedServices[$value['service_id']])) {
$stmt = $dbh_sqlite->prepare("INSERT INTO service (service_id, service_description, service_template_model_stm_id) VALUES ( $stmt = $dbh_sqlite->prepare("
:service_id, :service_description, :service_template_model_stm_id)"); INSERT INTO service (service_id, service_description, service_template_model_stm_id)
VALUES (:service_id, :service_description, :service_template_model_stm_id)
");
$stmt->bindParam(':service_id', $value['service_id'], PDO::PARAM_INT); $stmt->bindParam(':service_id', $value['service_id'], PDO::PARAM_INT);
$stmt->bindParam(':service_description', $value['service_description'], PDO::PARAM_STR); $stmt->bindParam(':service_description', $value['service_description'], PDO::PARAM_STR);
$stmt->bindParam(':service_template_model_stm_id', $value['service_template_model_stm_id'], PDO::PARAM_INT); $stmt->bindParam(':service_template_model_stm_id', $value['service_template_model_stm_id'], PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
$stmt = $dbh_sqlite->prepare("INSERT INTO extended_service_information (service_service_id, esi_notes) VALUES ( $stmt = $dbh_sqlite->prepare(
:service_service_id, :esi_notes)"); "INSERT INTO extended_service_information (service_service_id, esi_notes)
VALUES (:service_service_id, :esi_notes)
");
$stmt->bindParam(':service_service_id', $value['service_id'], PDO::PARAM_INT); $stmt->bindParam(':service_service_id', $value['service_id'], PDO::PARAM_INT);
$stmt->bindParam(':esi_notes', $value['esi_notes'], PDO::PARAM_STR); $stmt->bindParam(':esi_notes', $value['esi_notes'], PDO::PARAM_STR);
$stmt->execute(); $stmt->execute();
...@@ -416,8 +420,10 @@ try { ...@@ -416,8 +420,10 @@ try {
$insertedServices[$value['service_id']] = true; $insertedServices[$value['service_id']] = true;
} }
$stmt = $dbh_sqlite->prepare("INSERT INTO host_service_relation (service_service_id, host_host_id) VALUES ( $stmt = $dbh_sqlite->prepare("
:service_service_id, :host_host_id)"); INSERT INTO host_service_relation (service_service_id, host_host_id)
VALUES (:service_service_id, :host_host_id)
");
$stmt->bindParam(':service_service_id', $value['service_id'], PDO::PARAM_INT); $stmt->bindParam(':service_service_id', $value['service_id'], PDO::PARAM_INT);
$stmt->bindParam(':host_host_id', $value['host_id'], PDO::PARAM_INT); $stmt->bindParam(':host_host_id', $value['host_id'], PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
...@@ -425,6 +431,7 @@ try { ...@@ -425,6 +431,7 @@ try {
$insertedHostServiceRelation[$value['service_id'] . "-" . $value['host_id']] = true; $insertedHostServiceRelation[$value['service_id'] . "-" . $value['host_id']] = true;
} }
} }
// Insert services by hostgroup // Insert services by hostgroup
foreach ($result_services_from_hg as $value) { foreach ($result_services_from_hg as $value) {
if (!isset($insertedServices[$value['service_id']])) { if (!isset($insertedServices[$value['service_id']])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment