aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar aldot <aldot@5e8054f6-fb45-0410-9d17-f830fe724320>2009-04-21 09:44:57 +0000
committerGravatar aldot <aldot@5e8054f6-fb45-0410-9d17-f830fe724320>2009-04-21 09:44:57 +0000
commit9a699fa106cab4dc77d2619c53d0920875a6ebb2 (patch)
tree069d9fc797a19ccd3bc43a76deaee21f2f292d4e
parentab510c8959678f284fd31eb33f7abee7a843c74e (diff)
downloadndoutils-oracle-9a699fa106cab4dc77d2619c53d0920875a6ebb2.tar.gz
ndoutils-oracle-9a699fa106cab4dc77d2619c53d0920875a6ebb2.tar.bz2
- no need to quote numbers
git-svn-id: https://www.nagiosforge.org/svn/ndoutils_oracle/trunk/ndoutils-1.4b7-oracle@85 5e8054f6-fb45-0410-9d17-f830fe724320
-rw-r--r--src/dbhandlers.c356
1 files changed, 178 insertions, 178 deletions
diff --git a/src/dbhandlers.c b/src/dbhandlers.c
index 5456018..768218e 100644
--- a/src/dbhandlers.c
+++ b/src/dbhandlers.c
@@ -833,7 +833,7 @@ int ndo2db_handle_timedeventdata(ndo2db_idi *idi){
free(buf1);
#else
- if(asprintf(&buf1, "instance_id='%lu' AND event_type='%d' AND scheduled_time=%s AND object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND event_type=%d AND scheduled_time=%s AND object_id=%lu"
,idi->dbinfo.instance_id
,event_type
,ts[1]
@@ -841,14 +841,14 @@ int ndo2db_handle_timedeventdata(ndo2db_idi *idi){
)==-1)
buf1=NULL;
- if(asprintf(&buf2, "queued_time=%s, queued_time_usec='%lu', recurring_event='%d'"
+ if(asprintf(&buf2, "queued_time=%s, queued_time_usec=%lu, recurring_event=%d"
,ts[0]
,tstamp.tv_usec
,recurring_event
)==-1)
buf2=NULL;
- if(asprintf(&buf3,"(instance_id, event_type, queued_time, queued_time_usec, scheduled_time, recurring_event, object_id) VALUES ('%lu', '%d', %s, '%lu', %s, '%d', '%lu')"
+ if(asprintf(&buf3,"(instance_id, event_type, queued_time, queued_time_usec, scheduled_time, recurring_event, object_id) VALUES (%lu, %d, %s, %lu, %s, %d, %lu)"
,idi->dbinfo.instance_id
,event_type
,ts[0]
@@ -900,7 +900,7 @@ int ndo2db_handle_timedeventdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND event_type='%d' AND scheduled_time=%s AND object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND event_type=%d AND scheduled_time=%s AND object_id=%lu"
,idi->dbinfo.instance_id
,event_type
,ts[1]
@@ -908,14 +908,14 @@ int ndo2db_handle_timedeventdata(ndo2db_idi *idi){
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "event_time=%s, event_time_usec='%lu', recurring_event='%d'"
+ if(asprintf(&buf2, "event_time=%s, event_time_usec=%lu, recurring_event=%d"
,ts[0]
,tstamp.tv_usec
,recurring_event
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, event_type, event_time, event_time_usec, scheduled_time, recurring_event, object_id) VALUES ('%lu', '%d', %s, '%lu', %s, '%d', '%lu')"
+ if(asprintf(&buf3,"(instance_id, event_type, event_time, event_time_usec, scheduled_time, recurring_event, object_id) VALUES (%lu, %d, %s, %lu, %s, %d, %lu)"
,idi->dbinfo.instance_id
,event_type
,ts[0]
@@ -1162,7 +1162,7 @@ int ndo2db_handle_systemcommanddata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND start_time=%s AND start_time_usec='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND start_time=%s AND start_time_usec=%lu"
,idi->dbinfo.instance_id
,ts[0]
,start_time.tv_usec
@@ -1170,7 +1170,7 @@ int ndo2db_handle_systemcommanddata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "end_time=%s, end_time_usec='%lu', command_line='%s', timeout='%d', early_timeout='%d', execution_time='%lf', return_code='%d', output='%s'"
+ if(asprintf(&buf2, "end_time=%s, end_time_usec=%lu, command_line='%s', timeout=%d, early_timeout=%d, execution_time=%lf, return_code=%d, output='%s'"
,ts[1]
,end_time.tv_usec
,es[0]
@@ -1183,7 +1183,7 @@ int ndo2db_handle_systemcommanddata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, start_time, start_time_usec, end_time, end_time_usec, command_line, timeout, early_timeout, execution_time, return_code, output) VALUES ('%lu', %s, '%lu', %s, '%lu', '%s', '%d', '%d', '%lf', '%d', '%s')"
+ if(asprintf(&buf3,"(instance_id, start_time, start_time_usec, end_time, end_time_usec, command_line, timeout, early_timeout, execution_time, return_code, output) VALUES (%lu, %s, %lu, %s, %lu, '%s', %d, %d, %lf, %d, '%s')"
,idi->dbinfo.instance_id
,ts[0]
,start_time.tv_usec
@@ -1311,7 +1311,7 @@ int ndo2db_handle_eventhandlerdata(ndo2db_idi *idi){
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND start_time=%s AND start_time_usec='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND start_time=%s AND start_time_usec=%lu"
,idi->dbinfo.instance_id
,ts[0]
,start_time.tv_usec
@@ -1319,7 +1319,7 @@ int ndo2db_handle_eventhandlerdata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "eventhandler_type='%d', object_id='%lu', state='%d', state_type='%d', end_time=%s, end_time_usec='%lu', command_object_id='%lu', command_args='%s', command_line='%s', timeout='%d', early_timeout='%d', execution_time='%lf', return_code='%d', output='%s'"
+ if(asprintf(&buf2, "eventhandler_type=%d, object_id=%lu, state=%d, state_type=%d, end_time=%s, end_time_usec=%lu, command_object_id=%lu, command_args='%s', command_line='%s', timeout=%d, early_timeout=%d, execution_time=%lf, return_code=%d, output='%s'"
,eventhandler_type
,object_id
,state
@@ -1338,7 +1338,7 @@ int ndo2db_handle_eventhandlerdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, eventhandler_type, object_id, state, state_type, start_time, start_time_usec, end_time, end_time_usec, command_object_id, command_args, command_line, timeout, early_timeout, execution_time, return_code, output) VALUES ('%lu', '%d', '%lu', '%d', '%d', %s, '%lu', %s, '%lu', '%lu', '%s', '%s', '%d', '%d', '%lf', '%d', '%s')"
+ if(asprintf(&buf3,"(instance_id, eventhandler_type, object_id, state, state_type, start_time, start_time_usec, end_time, end_time_usec, command_object_id, command_args, command_line, timeout, early_timeout, execution_time, return_code, output) VALUES (%lu, %d, %lu, %d, %d, %s, %lu, %s, %lu, %lu, '%s', '%s', %d, %d, %lf, %d, '%s')"
,idi->dbinfo.instance_id
,eventhandler_type
,object_id
@@ -1457,7 +1457,7 @@ int ndo2db_handle_notificationdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND start_time=%s AND start_time_usec='%lu' AND object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND start_time=%s AND start_time_usec=%lu AND object_id=%lu"
,idi->dbinfo.instance_id
,ts[0]
,start_time.tv_usec
@@ -1466,7 +1466,7 @@ int ndo2db_handle_notificationdata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "notification_type='%d', notification_reason='%d', end_time=%s, end_time_usec='%lu', state='%d', output='%s', escalated='%d', contacts_notified='%d'"
+ if(asprintf(&buf2, "notification_type=%d, notification_reason=%d, end_time=%s, end_time_usec=%lu, state=%d, output='%s', escalated=%d, contacts_notified=%d"
,notification_type
,notification_reason
,ts[1]
@@ -1479,7 +1479,7 @@ int ndo2db_handle_notificationdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, notification_type, notification_reason, start_time, start_time_usec, end_time, end_time_usec, object_id, state, output, escalated, contacts_notified) VALUES ('%lu', '%d', '%d', %s, '%lu', %s, '%lu', '%lu', '%d', '%s', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, notification_type, notification_reason, start_time, start_time_usec, end_time, end_time_usec, object_id, state, output, escalated, contacts_notified) VALUES (%lu, %d, %d, %s, %lu, %s, %lu, %lu, %d, '%s', %d, %d)"
,idi->dbinfo.instance_id
,notification_type
,notification_reason
@@ -1505,7 +1505,7 @@ int ndo2db_handle_notificationdata(ndo2db_idi *idi){
free(buf1);
free(buf2);
free(buf3);
-#endif
+#endif
result=ndo2db_db_query(idi,buf);
/* save the notification id for later use... */
@@ -1590,7 +1590,7 @@ int ndo2db_handle_contactnotificationdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND contact_object_id='%lu' AND start_time=%s AND start_time_usec='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND contact_object_id=%lu AND start_time=%s AND start_time_usec=%lu"
,idi->dbinfo.instance_id
,contact_id
,ts[0]
@@ -1599,7 +1599,7 @@ int ndo2db_handle_contactnotificationdata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "notification_id='%lu', end_time=%s, end_time_usec='%lu'"
+ if(asprintf(&buf2, "notification_id=%lu, end_time=%s, end_time_usec=%lu"
,idi->dbinfo.last_notification_id
,ts[1]
,end_time.tv_usec
@@ -1607,7 +1607,7 @@ int ndo2db_handle_contactnotificationdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, notification_id, start_time, start_time_usec, end_time, end_time_usec, contact_object_id) VALUES ('%lu', '%lu', %s, '%lu', %s, '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, notification_id, start_time, start_time_usec, end_time, end_time_usec, contact_object_id) VALUES (%lu, %lu, %s, %lu, %s, %lu, %lu)"
,idi->dbinfo.instance_id
,idi->dbinfo.last_notification_id
,ts[0]
@@ -1719,7 +1719,7 @@ int ndo2db_handle_contactnotificationmethoddata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND contactnotification_id='%lu' AND start_time=%s AND start_time_usec='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND contactnotification_id=%lu AND start_time=%s AND start_time_usec=%lu"
,idi->dbinfo.instance_id
,idi->dbinfo.last_contact_notification_id
,ts[0]
@@ -1728,7 +1728,7 @@ int ndo2db_handle_contactnotificationmethoddata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "end_time=%s, end_time_usec='%lu', command_object_id='%lu', command_args='%s'"
+ if(asprintf(&buf2, "end_time=%s, end_time_usec=%lu, command_object_id=%lu, command_args='%s'"
,ts[1]
,end_time.tv_usec
,command_id
@@ -1737,7 +1737,7 @@ int ndo2db_handle_contactnotificationmethoddata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, contactnotification_id, start_time, start_time_usec, end_time, end_time_usec, command_object_id, command_args) VALUES ('%lu', '%lu', %s, '%lu', %s, '%lu', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, contactnotification_id, start_time, start_time_usec, end_time, end_time_usec, command_object_id, command_args) VALUES (%lu, %lu, %s, %lu, %s, %lu, %lu, '%s')"
,idi->dbinfo.instance_id
,idi->dbinfo.last_contact_notification_id
,ts[0]
@@ -2045,7 +2045,7 @@ int ndo2db_handle_hostcheckdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND host_object_id='%lu' AND start_time=%s AND start_time_usec='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu' AND host_object_id=%lu AND start_time=%s AND start_time_usec=%lu"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -2054,7 +2054,7 @@ int ndo2db_handle_hostcheckdata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "check_type='%d', is_raw_check='%d', current_check_attempt='%d', max_check_attempts='%d', state='%d', state_type='%d', end_time=%s, end_time_usec='%lu', timeout='%d', early_timeout='%d', execution_time='%lf', latency='%lf', return_code='%d', output='%s', perfdata='%s'"
+ if(asprintf(&buf2, "check_type=%d, is_raw_check=%d, current_check_attempt=%d, max_check_attempts=%d, state=%d, state_type=%d, end_time=%s, end_time_usec=%lu, timeout=%d, early_timeout=%d, execution_time=%lf, latency=%lf, return_code=%d, output='%s', perfdata='%s'"
,check_type
,is_raw_check
,current_check_attempt
@@ -2074,7 +2074,7 @@ int ndo2db_handle_hostcheckdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(command_object_id, command_args, command_line, instance_id, host_object_id, check_type, is_raw_check, current_check_attempt, max_check_attempts, state, state_type, start_time, start_time_usec, end_time, end_time_usec, timeout, early_timeout, execution_time, latency, return_code, output, perfdata) VALUES ('%lu', '%s', '%s', '%lu', '%lu', '%d', '%d', '%d', '%d', '%d', '%d', %s, '%lu', %s, '%lu', '%d', '%d', '%lf', '%lf', '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(command_object_id, command_args, command_line, instance_id, host_object_id, check_type, is_raw_check, current_check_attempt, max_check_attempts, state, state_type, start_time, start_time_usec, end_time, end_time_usec, timeout, early_timeout, execution_time, latency, return_code, output, perfdata) VALUES (%lu, '%s', '%s', %lu, %lu, %d, %d, %d, %d, %d, %d, %s, %lu, %s, %lu, %d, %d, %lf, %lf, %d, '%s', '%s')"
,command_id
,es[0]
,es[1]
@@ -2207,16 +2207,16 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
buf=NULL;
free(buf1);
#else
- /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND comment_time=%s AND internal_comment_id='%lu'"
+ /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
+ if(asprintf(&buf1, "instance_id=%lu AND comment_time=%s AND internal_comment_id=%lu"
,idi->dbinfo.instance_id
,ts[1]
,internal_comment_id
)==-1)
buf1=NULL;
- /* Values to set when updating */
- if(asprintf(&buf2, "comment_type='%d', entry_type='%d', object_id='%lu', author_name='%s', comment_data='%s', is_persistent='%d', comment_source='%d', expires='%d', expiration_time=%s"
+ /* Values to set when updating */
+ if(asprintf(&buf2, "comment_type=%d, entry_type=%d, object_id=%lu, author_name='%s', comment_data='%s', is_persistent=%d, comment_source=%d, expires=%d, expiration_time=%s"
,comment_type
,entry_type
,object_id
@@ -2229,8 +2229,8 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
)==-1)
buf2=NULL;
- /* the data part of the INSERT statement */
- if(asprintf(&buf3,"(entry_time, entry_time_usec, instance_id, comment_type, entry_type, object_id, comment_time, internal_comment_id, author_name, comment_data, is_persistent, comment_source, expires, expiration_time) VALUES ('%s', '%lu', '%lu', '%d', '%d', '%lu', %s, '%lu', '%s', '%s', '%d', '%d', '%d', %s)"
+ /* the data part of the INSERT statement */
+ if(asprintf(&buf3,"(entry_time, entry_time_usec, instance_id, comment_type, entry_type, object_id, comment_time, internal_comment_id, author_name, comment_data, is_persistent, comment_source, expires, expiration_time) VALUES (%s, %lu, %lu, %d, %d, %lu, %s, %lu, '%s', '%s', %d, %d, %d, %s)"
,ts[0]
,tstamp.tv_usec
,idi->dbinfo.instance_id
@@ -2248,16 +2248,16 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
)==-1)
buf3=NULL;
- if(asprintf(&buf,"MERGE INTO %s USING DUAL ON (%s) WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT %s"
+ if(asprintf(&buf,"MERGE INTO %s USING DUAL ON (%s) WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_COMMENTS]
,buf1
,buf2
,buf3
)==-1)
buf=NULL;
- free(buf1);
- free(buf2);
- free(buf3);
+ free(buf1);
+ free(buf2);
+ free(buf3);
#endif
result=ndo2db_db_query(idi,buf);
free(buf);
@@ -2313,7 +2313,7 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND comment_time=%s AND internal_comment_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND comment_time=%s AND internal_comment_id=%lu"
,idi->dbinfo.instance_id
,ts[1]
,internal_comment_id
@@ -2321,7 +2321,7 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "comment_type='%d', entry_type='%d', object_id='%lu', author_name='%s', comment_data='%s', is_persistent='%d', comment_source='%d', expires='%d', expiration_time=%s"
+ if(asprintf(&buf2, "comment_type=%d, entry_type=%d, object_id=%lu, author_name='%s', comment_data='%s', is_persistent=%d, comment_source=%d, expires=%d, expiration_time=%s"
,comment_type
,entry_type
,object_id
@@ -2335,7 +2335,7 @@ int ndo2db_handle_commentdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(entry_time, entry_time_usec, instance_id, comment_type, entry_type, object_id, comment_time, internal_comment_id, author_name, comment_data, is_persistent, comment_source, expires, expiration_time) VALUES ('%s', '%lu', '%lu', '%d', '%d', '%lu', %s, '%lu', '%s', '%s', '%d', '%d', '%d', %s)"
+ if(asprintf(&buf3,"(entry_time, entry_time_usec, instance_id, comment_type, entry_type, object_id, comment_time, internal_comment_id, author_name, comment_data, is_persistent, comment_source, expires, expiration_time) VALUES (%s, %lu, %lu, %d, %d, %lu, %s, %lu, '%s', '%s', %d, %d, %d, %s)"
,ts[0]
,tstamp.tv_usec
,idi->dbinfo.instance_id
@@ -2476,17 +2476,17 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
buf=NULL;
free(buf1);
#else
- /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND object_id='%lu' AND entry_time=%s AND internal_downtime_id='%lu'"
+ /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
+ if(asprintf(&buf1, "instance_id=%lu AND object_id=%lu AND entry_time=%s AND internal_downtime_id=%lu"
,idi->dbinfo.instance_id
,object_id
,ts[1]
,internal_downtime_id
- )==-1)
- buf1=NULL;
-
+ )==-1)
+ buf1=NULL;
+
/* Values to set when updating */
- if(asprintf(&buf2, "downtime_type='%d', author_name='%s', comment_data='%s', triggered_by_id='%lu', is_fixed='%d', duration='%lu', scheduled_start_time=%s, scheduled_end_time=%s"
+ if(asprintf(&buf2, "downtime_type=%d, author_name='%s', comment_data='%s', triggered_by_id=%lu, is_fixed=%d, duration=%lu, scheduled_start_time=%s, scheduled_end_time=%s"
,downtime_type
,es[0]
,es[1]
@@ -2499,7 +2499,7 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, downtime_type, object_id, entry_time, author_name, comment_data, internal_downtime_id, triggered_by_id, is_fixed, duration, scheduled_start_time, scheduled_end_time) VALUES ('%lu', '%d', '%lu', %s, '%s', '%s', '%lu', '%lu', '%d', '%lu', %s, %s)"
+ if(asprintf(&buf3,"(instance_id, downtime_type, object_id, entry_time, author_name, comment_data, internal_downtime_id, triggered_by_id, is_fixed, duration, scheduled_start_time, scheduled_end_time) VALUES (%lu, %d, %lu, %s, '%s', '%s', %lu, %lu, %d, %lu, %s, %s)"
,idi->dbinfo.instance_id
,downtime_type
,object_id
@@ -2514,7 +2514,7 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
,ts[3]
)==-1)
buf3=NULL;
-
+
if(asprintf(&buf,"MERGE INTO %s USING DUAL ON (%s) WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_DOWNTIMEHISTORY]
,buf1
@@ -2607,7 +2607,7 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND object_id='%lu' AND entry_time=%s AND internal_downtime_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND object_id=%lu AND entry_time=%s AND internal_downtime_id=%lu"
,idi->dbinfo.instance_id
,object_id
,ts[1]
@@ -2616,7 +2616,7 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "downtime_type='%d', author_name='%s', comment_data='%s', triggered_by_id='%lu', is_fixed='%d', duration='%lu', scheduled_start_time=%s, scheduled_end_time=%s"
+ if(asprintf(&buf2, "downtime_type=%d, author_name='%s', comment_data='%s', triggered_by_id=%lu, is_fixed=%d, duration=%lu, scheduled_start_time=%s, scheduled_end_time=%s"
,downtime_type
,es[0]
,es[1]
@@ -2629,7 +2629,7 @@ int ndo2db_handle_downtimedata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, downtime_type, object_id, entry_time, author_name, comment_data, internal_downtime_id, triggered_by_id, is_fixed, duration, scheduled_start_time, scheduled_end_time) VALUES ('%lu', '%d', '%lu', %s, '%s', '%s', '%lu', '%lu', '%d', '%lu', %s, %s)"
+ if(asprintf(&buf3,"(instance_id, downtime_type, object_id, entry_time, author_name, comment_data, internal_downtime_id, triggered_by_id, is_fixed, duration, scheduled_start_time, scheduled_end_time) VALUES (%lu, %d, %lu, %s, '%s', '%s', %lu, %lu, %d, %lu, %s, %s)"
,idi->dbinfo.instance_id
,downtime_type
,object_id
@@ -2880,13 +2880,13 @@ int ndo2db_handle_programstatusdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "status_update_time=%s, program_start_time=%s, is_currently_running='1', process_id='%lu', daemon_mode='%d', last_command_check=%s, last_log_rotation=%s, notifications_enabled='%d', active_service_checks_enabled='%d', passive_service_checks_enabled='%d', active_host_checks_enabled='%d', passive_host_checks_enabled='%d', event_handlers_enabled='%d', flap_detection_enabled='%d', failure_prediction_enabled='%d', process_performance_data='%d', obsess_over_hosts='%d', obsess_over_services='%d', modified_host_attributes='%lu', modified_service_attributes='%lu', global_host_event_handler='%s', global_service_event_handler='%s'"
+ if(asprintf(&buf2, "status_update_time=%s, program_start_time=%s, is_currently_running=1, process_id=%lu, daemon_mode=%d, last_command_check=%s, last_log_rotation=%s, notifications_enabled=%d, active_service_checks_enabled=%d, passive_service_checks_enabled=%d, active_host_checks_enabled=%d, passive_host_checks_enabled=%d, event_handlers_enabled=%d, flap_detection_enabled=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_hosts=%d, obsess_over_services=%d, modified_host_attributes=%lu, modified_service_attributes=%lu, global_host_event_handler='%s', global_service_event_handler='%s'"
,ts[0]
,ts[1]
,process_id
@@ -2912,7 +2912,7 @@ int ndo2db_handle_programstatusdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, status_update_time, program_start_time, is_currently_running, process_id, daemon_mode, last_command_check, last_log_rotation, notifications_enabled, active_service_checks_enabled, passive_service_checks_enabled, active_host_checks_enabled, passive_host_checks_enabled, event_handlers_enabled, flap_detection_enabled, failure_prediction_enabled, process_performance_data, obsess_over_hosts, obsess_over_services, modified_host_attributes, modified_service_attributes, global_host_event_handler, global_service_event_handler) VALUES ('%lu', %s, %s, '1', '%lu', '%d', %s, %s, '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%lu', '%lu', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, status_update_time, program_start_time, is_currently_running, process_id, daemon_mode, last_command_check, last_log_rotation, notifications_enabled, active_service_checks_enabled, passive_service_checks_enabled, active_host_checks_enabled, passive_host_checks_enabled, event_handlers_enabled, flap_detection_enabled, failure_prediction_enabled, process_performance_data, obsess_over_hosts, obsess_over_services, modified_host_attributes, modified_service_attributes, global_host_event_handler, global_service_event_handler) VALUES (%lu, %s, %s, '1', %lu, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lu, %lu, '%s', '%s')"
,idi->dbinfo.instance_id
,ts[0]
,ts[1]
@@ -3151,13 +3151,13 @@ int ndo2db_handle_hoststatusdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "host_object_id='%lu'"
+ if(asprintf(&buf1, "host_object_id=%lu"
,object_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', status_update_time=%s, output='%s', perfdata='%s', current_state='%d', has_been_checked='%d', should_be_scheduled='%d', current_check_attempt='%d', max_check_attempts='%d', last_check=%s, next_check=%s, check_type='%d', last_state_change=%s, last_hard_state_change=%s, last_hard_state='%d', last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type='%d', last_notification=%s, next_notification=%s, no_more_notifications='%d', notifications_enabled='%d', problem_has_been_acknowledged='%d', acknowledgement_type='%d', current_notification_number='%d', passive_checks_enabled='%d', active_checks_enabled='%d', event_handler_enabled='%d', flap_detection_enabled='%d', is_flapping='%d', percent_state_change='%lf', latency='%lf', execution_time='%lf', scheduled_downtime_depth='%d', failure_prediction_enabled='%d', process_performance_data='%d', obsess_over_host='%d', modified_host_attributes='%lu', event_handler='%s', check_command='%s', normal_check_interval='%lf', retry_check_interval='%lf', check_timeperiod_object_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu, status_update_time=%s, output='%s', perfdata='%s', current_state=%d, has_been_checked=%d, should_be_scheduled=%d, current_check_attempt=%d, max_check_attempts=%d, last_check=%s, next_check=%s, check_type=%d, last_state_change=%s, last_hard_state_change=%s, last_hard_state=%d, last_time_up=%s, last_time_down=%s, last_time_unreachable=%s, state_type=%d, last_notification=%s, next_notification=%s, no_more_notifications=%d, notifications_enabled=%d, problem_has_been_acknowledged=%d, acknowledgement_type=%d, current_notification_number=%d, passive_checks_enabled=%d, active_checks_enabled=%d, event_handler_enabled=%d, flap_detection_enabled=%d, is_flapping=%d, percent_state_change=%lf, latency=%lf, execution_time=%lf, scheduled_downtime_depth=%d, failure_prediction_enabled=%d, process_performance_data=%d, obsess_over_host=%d, modified_host_attributes=%lu, event_handler='%s', check_command='%s', normal_check_interval=%lf, retry_check_interval=%lf, check_timeperiod_object_id=%lu"
,idi->dbinfo.instance_id
,ts[0]
,es[0]
@@ -3206,7 +3206,7 @@ int ndo2db_handle_hoststatusdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, host_object_id, status_update_time, output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, percent_state_change, latency, execution_time, scheduled_downtime_depth, failure_prediction_enabled, process_performance_data, obsess_over_host, modified_host_attributes, event_handler, check_command, normal_check_interval, retry_check_interval, check_timeperiod_object_id) VALUES ('%lu', '%lu', %s, '%s', '%s', '%d', '%d', '%d', '%d', '%d', %s, %s, '%d', %s, %s, '%d', %s, %s, %s, '%d', %s, %s, '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%lf', '%lf', '%lf', '%d', '%d', '%d', '%d', '%lu', '%s', '%s', '%lf', '%lf', '%lu')"
+ if(asprintf(&buf3,"(instance_id, host_object_id, status_update_time, output, perfdata, current_state, has_been_checked, should_be_scheduled, current_check_attempt, max_check_attempts, last_check, next_check, check_type, last_state_change, last_hard_state_change, last_hard_state, last_time_up, last_time_down, last_time_unreachable, state_type, last_notification, next_notification, no_more_notifications, notifications_enabled, problem_has_been_acknowledged, acknowledgement_type, current_notification_number, passive_checks_enabled, active_checks_enabled, event_handler_enabled, flap_detection_enabled, is_flapping, percent_state_change, latency, execution_time, scheduled_downtime_depth, failure_prediction_enabled, process_performance_data, obsess_over_host, modified_host_attributes, event_handler, check_command, normal_check_interval, retry_check_interval, check_timeperiod_object_id) VALUES (%lu, %lu, %s, '%s', '%s', %d, %d, %d, %d, %d, %s, %s, %d, %s, %s, %d, %s, %s, %s, %d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %d, %d, %d, %d, %lu, '%s', '%s', %lf, %lf, %lu)"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -3309,15 +3309,15 @@ int ndo2db_handle_hoststatusdata(ndo2db_idi *idi){
buf=NULL;
free(buf1);
#else
- /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "object_id='%lu' AND varname='%s'"
+ /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
+ if(asprintf(&buf1, "object_id=%lu AND varname='%s'"
,object_id
,(es[0]==NULL)?"":es[0]
- )==-1)
- buf1=NULL;
-
- /* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', status_update_time=%s, has_been_modified='%d', varvalue='%s'"
+ )==-1)
+ buf1=NULL;
+
+ /* Values to set when updating */
+ if(asprintf(&buf2, "instance_id=%lu, status_update_time=%s, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,ts[0]
,has_been_modified
@@ -3326,7 +3326,7 @@ int ndo2db_handle_hoststatusdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, status_update_time, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu', %s, '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, status_update_time, has_been_modified, varname, varvalue) VALUES (%lu, %lu, %s, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -3786,14 +3786,14 @@ int ndo2db_handle_servicestatusdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "object_id='%lu' AND varname='%s'"
+ if(asprintf(&buf1, "object_id=%lu AND varname='%s'"
,object_id
,(es[0]==NULL)?"":es[0]
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', status_update_time=%s, has_been_modified='%d', varvalue='%s'"
+ if(asprintf(&buf2, "instance_id=%lu, status_update_time=%s, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,ts[0]
,has_been_modified
@@ -3802,7 +3802,7 @@ int ndo2db_handle_servicestatusdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, status_update_time, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu', %s, '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, status_update_time, has_been_modified, varname, varvalue) VALUES (%lu, %lu, %s, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -3915,13 +3915,13 @@ int ndo2db_handle_contactstatusdata(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "contact_object_id='%lu'"
+ if(asprintf(&buf1, "contact_object_id=%lu"
,object_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', status_update_time=%s, host_notifications_enabled='%d', service_notifications_enabled='%d', last_host_notification=%s, last_service_notification=%s, modified_attributes='%lu', modified_host_attributes='%lu', modified_service_attributes='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu, status_update_time=%s, host_notifications_enabled=%d, service_notifications_enabled=%d, last_host_notification=%s, last_service_notification=%s, modified_attributes=%lu, modified_host_attributes=%lu, modified_service_attributes=%lu"
,idi->dbinfo.instance_id
,ts[0]
,host_notifications_enabled
@@ -3935,7 +3935,7 @@ int ndo2db_handle_contactstatusdata(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, contact_object_id, status_update_time, host_notifications_enabled, service_notifications_enabled, last_host_notification, last_service_notification, modified_attributes, modified_host_attributes, modified_service_attributes) VALUES ('%lu', '%lu', %s, '%d', '%d', %s, %s, '%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, contact_object_id, status_update_time, host_notifications_enabled, service_notifications_enabled, last_host_notification, last_service_notification, modified_attributes, modified_host_attributes, modified_service_attributes) VALUES (%lu, %lu, %s, %d, %d, %s, %s, %lu, %lu, %lu)"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -3999,23 +3999,23 @@ int ndo2db_handle_contactstatusdata(ndo2db_idi *idi){
buf=NULL;
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, " object_id='%lu' AND varname='%s'"
+ if(asprintf(&buf1, " object_id=%lu AND varname='%s'"
,object_id
,(es[0]==NULL)?"":es[0]
)==-1)
buf1=NULL;
-
+
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu',status_update_time=%s, has_been_modified='%d', varvalue='%s'"
+ if(asprintf(&buf2, "instance_id=%lu,status_update_time=%s, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,ts[0]
,has_been_modified
,(es[1]==NULL)?"":es[1]
)==-1)
buf2=NULL;
-
+
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu',%s, '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, has_been_modified, varname, varvalue) VALUES (%lu, %lu,%s, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,object_id
,ts[0]
@@ -4235,7 +4235,7 @@ int ndo2db_handle_acknowledgementdata(ndo2db_idi *idi){
free(buf1);
#else
/* the data part of the INSERT statement */
- if(asprintf(&buf1,"(instance_id, entry_time, entry_time_usec, acknowledgement_type, object_id, state, author_name, comment_data, is_sticky, persistent_comment, notify_contacts) VALUES ('%lu', %s, '%lu', '%d', '%lu', '%d', '%s', '%s', '%d', '%d', '%d')"
+ if(asprintf(&buf1,"(instance_id, entry_time, entry_time_usec, acknowledgement_type, object_id, state, author_name, comment_data, is_sticky, persistent_comment, notify_contacts) VALUES (%lu, %s, %lu, %d, %lu, %d, '%s', '%s', %d, %d, %d)"
,idi->dbinfo.instance_id
,ts[0]
,tstamp.tv_usec
@@ -4337,7 +4337,7 @@ int ndo2db_handle_statechangedata(ndo2db_idi *idi){
buf=NULL;
#else
/* the data part of the INSERT statement */
- if(asprintf(&buf1,"(instance_id, state_time, state_time_usec, object_id, state_change, state, state_type, current_check_attempt, max_check_attempts, last_state, last_hard_state, output) VALUES ('%lu', %s, '%lu', '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')"
+ if(asprintf(&buf1,"(instance_id, state_time, state_time_usec, object_id, state_change, state, state_type, current_check_attempt, max_check_attempts, last_state, last_hard_state, output) VALUES (%lu, %s, %lu, %lu, %d, %d, %d, %d, %d, %d, %d, '%s')"
,idi->dbinfo.instance_id
,ts[0]
,tstamp.tv_usec
@@ -4427,7 +4427,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND configfile_type='%d' AND configfile_path='%s'"
+ if(asprintf(&buf1, "instance_id=%lu AND configfile_type=%d AND configfile_path='%s'"
,idi->dbinfo.instance_id
,configfile_type
,es[0]
@@ -4435,7 +4435,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){
buf1=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf2,"(instance_id, configfile_type, configfile_path) VALUES ('%lu', '%d', '%s')"
+ if(asprintf(&buf2,"(instance_id, configfile_type, configfile_path) VALUES (%lu, %d, '%s')"
,idi->dbinfo.instance_id
,configfile_type
,es[0]
@@ -4509,7 +4509,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND configfile_id='%lu' AND varname='%s'"
+ if(asprintf(&buf1, "instance_id=%lu AND configfile_id=%lu AND varname='%s'"
,idi->dbinfo.instance_id
,configfile_id
,es[1]
@@ -4523,7 +4523,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, configfile_id, varname) VALUES ('%lu', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, configfile_id, varname) VALUES (%lu, %lu, '%s')"
,idi->dbinfo.instance_id
,configfile_id
,es[1]
@@ -4615,37 +4615,37 @@ int ndo2db_handle_runtimevariables(ndo2db_idi *idi){
buf=NULL;
free(buf1);
#else
- /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND varname='%s'"
+ /* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
+ if(asprintf(&buf1, "instance_id=%lu AND varname='%s'"
,idi->dbinfo.instance_id
,es[0]
- )==-1)
- buf1=NULL;
+ )==-1)
+ buf1=NULL;
- /* Values to set when updating */
- if(asprintf(&buf2, "varvalue='%s'"
+ /* Values to set when updating */
+ if(asprintf(&buf2, "varvalue='%s'"
,es[1]
- )==-1)
- buf2=NULL;
+ )==-1)
+ buf2=NULL;
- /* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, varname, varvalue) VALUES ('%lu', '%s', '%s')"
+ /* the data part of the INSERT statement */
+ if(asprintf(&buf3,"(instance_id, varname, varvalue) VALUES (%lu, '%s', '%s')"
,idi->dbinfo.instance_id
,es[0]
,es[1]
- )==-1)
- buf3=NULL;
+ )==-1)
+ buf3=NULL;
- if(asprintf(&buf,"MERGE INTO %s USING DUAL ON (%s) WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT %s"
+ if(asprintf(&buf,"MERGE INTO %s USING DUAL ON (%s) WHEN MATCHED THEN UPDATE SET %s WHEN NOT MATCHED THEN INSERT %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_RUNTIMEVARIABLES]
,buf1
,buf2
- ,buf3
- )==-1)
- buf=NULL;
- free(buf1);
- free(buf2);
- free(buf3);
+ ,buf3
+ )==-1)
+ buf=NULL;
+ free(buf1);
+ free(buf2);
+ free(buf3);
#endif
result=ndo2db_db_query(idi,buf);
free(buf);
@@ -4904,7 +4904,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND host_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND host_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -4912,7 +4912,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "alias='%s', display_name='%s', address='%s', check_command_object_id='%lu', check_command_args='%s', eventhandler_command_object_id='%lu', eventhandler_command_args='%s', check_timeperiod_object_id='%lu', notif_timeperiod_object_id='%lu', failure_prediction_options='%s', check_interval='%lf', retry_interval='%lf', max_check_attempts='%d', first_notification_delay='%lf', notification_interval='%lf', notify_on_down='%d', notify_on_unreachable='%d', notify_on_recovery='%d', notify_on_flapping='%d', notify_on_downtime='%d', stalk_on_up='%d', stalk_on_down='%d', stalk_on_unreachable='%d', flap_detection_enabled='%d', flap_detection_on_up='%d', flap_detection_on_down='%d', flap_detection_on_unreachable='%d', low_flap_threshold='%lf', high_flap_threshold='%lf', process_performance_data='%d', freshness_checks_enabled='%d', freshness_threshold='%d', passive_checks_enabled='%d', event_handler_enabled='%d', active_checks_enabled='%d', retain_status_information='%d', retain_nonstatus_information='%d', notifications_enabled='%d', obsess_over_host='%d', failure_prediction_enabled='%d', notes='%s', notes_url='%s', action_url='%s', icon_image='%s', icon_image_alt='%s', vrml_image='%s', statusmap_image='%s', have_2d_coords='%d', x_2d='%d', y_2d='%d', have_3d_coords='%d', x_3d='%lf', y_3d='%lf', z_3d='%lf'"
+ if(asprintf(&buf2, "alias='%s', display_name='%s', address='%s', check_command_object_id=%lu, check_command_args='%s', eventhandler_command_object_id=%lu, eventhandler_command_args='%s', check_timeperiod_object_id=%lu, notif_timeperiod_object_id=%lu, failure_prediction_options='%s', check_interval=%lf, retry_interval=%lf, max_check_attempts=%d, first_notification_delay=%lf, notification_interval=%lf, notify_on_down=%d, notify_on_unreachable=%d, notify_on_recovery=%d, notify_on_flapping=%d, notify_on_downtime=%d, stalk_on_up=%d, stalk_on_down=%d, stalk_on_unreachable=%d, flap_detection_enabled=%d, flap_detection_on_up=%d, flap_detection_on_down=%d, flap_detection_on_unreachable=%d, low_flap_threshold=%lf, high_flap_threshold=%lf, process_performance_data=%d, freshness_checks_enabled=%d, freshness_threshold=%d, passive_checks_enabled=%d, event_handler_enabled=%d, active_checks_enabled=%d, retain_status_information=%d, retain_nonstatus_information=%d, notifications_enabled=%d, obsess_over_host=%d, failure_prediction_enabled=%d, notes='%s', notes_url='%s', action_url='%s', icon_image='%s', icon_image_alt='%s', vrml_image='%s', statusmap_image='%s', have_2d_coords=%d, x_2d=%d, y_2d=%d, have_3d_coords=%d, x_3d=%lf, y_3d=%lf, z_3d=%lf"
,(es[12]==NULL)?"":es[12]
,(es[11]==NULL)?"":es[11]
,(es[0]==NULL)?"":es[0]
@@ -4971,7 +4971,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, host_object_id, alias, display_name, address, check_command_object_id, check_command_args, eventhandler_command_object_id, eventhandler_command_args, check_timeperiod_object_id, notif_timeperiod_object_id, failure_prediction_options, check_interval, retry_interval, max_check_attempts, first_notification_delay, notification_interval, notify_on_down, notify_on_unreachable, notify_on_recovery, notify_on_flapping, notify_on_downtime, stalk_on_up, stalk_on_down, stalk_on_unreachable, flap_detection_enabled, flap_detection_on_up, flap_detection_on_down, flap_detection_on_unreachable, low_flap_threshold, high_flap_threshold, process_performance_data, freshness_checks_enabled, freshness_threshold, passive_checks_enabled, event_handler_enabled, active_checks_enabled, retain_status_information, retain_nonstatus_information, notifications_enabled, obsess_over_host, failure_prediction_enabled, notes, notes_url, action_url, icon_image, icon_image_alt, vrml_image, statusmap_image, have_2d_coords, x_2d, y_2d, have_3d_coords, x_3d, y_3d, z_3d) VALUES ('%lu', '%d', '%lu', '%s', '%s', '%s', '%lu', '%s', '%lu', '%s', '%lu', '%lu', '%s', '%lf', '%lf', '%d', '%lf', '%lf', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%lf', '%lf', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%lf', '%lf', '%lf')"
+ if(asprintf(&buf3,"(instance_id, config_type, host_object_id, alias, display_name, address, check_command_object_id, check_command_args, eventhandler_command_object_id, eventhandler_command_args, check_timeperiod_object_id, notif_timeperiod_object_id, failure_prediction_options, check_interval, retry_interval, max_check_attempts, first_notification_delay, notification_interval, notify_on_down, notify_on_unreachable, notify_on_recovery, notify_on_flapping, notify_on_downtime, stalk_on_up, stalk_on_down, stalk_on_unreachable, flap_detection_enabled, flap_detection_on_up, flap_detection_on_down, flap_detection_on_unreachable, low_flap_threshold, high_flap_threshold, process_performance_data, freshness_checks_enabled, freshness_threshold, passive_checks_enabled, event_handler_enabled, active_checks_enabled, retain_status_information, retain_nonstatus_information, notifications_enabled, obsess_over_host, failure_prediction_enabled, notes, notes_url, action_url, icon_image, icon_image_alt, vrml_image, statusmap_image, have_2d_coords, x_2d, y_2d, have_3d_coords, x_3d, y_3d, z_3d) VALUES (%lu, %d, %lu, '%s', '%s', '%s', %lu, '%s', %lu, '%s', %lu, %lu, '%s', %lf, %lf, %d, %lf, %lf, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %lf, %lf, %lf)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -5090,20 +5090,20 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "host_id='%lu' AND parent_host_object_id='%lu'"
+ if(asprintf(&buf1, "host_id=%lu AND parent_host_object_id=%lu"
,host_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, host_id, parent_host_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, host_id, parent_host_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,host_id
,member_id
@@ -5151,20 +5151,20 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "host_id='%lu' AND contactgroup_object_id='%lu'"
+ if(asprintf(&buf1, "host_id=%lu AND contactgroup_object_id=%lu"
,host_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, host_id, contactgroup_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, host_id, contactgroup_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,host_id
,member_id
@@ -5212,7 +5212,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND host_id='%lu' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND host_id=%lu AND contact_object_id=%lu"
,idi->dbinfo.instance_id
,host_id
,member_id
@@ -5220,7 +5220,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
buf1=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, host_id, contact_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, host_id, contact_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,host_id
,member_id
@@ -5275,14 +5275,14 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "object_id='%lu' AND varname='%s'"
+ if(asprintf(&buf1, "object_id=%lu AND varname='%s'"
,object_id
,(es[0]==NULL)?"":es[0]
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', config_type='%d', has_been_modified='%d', varvalue='%s'"
+ if(asprintf(&buf2, "instance_id=%lu, config_type=%d, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,has_been_modified
@@ -5291,7 +5291,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu', '%d', '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES (%lu, %lu, %d, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,object_id
,idi->current_object_config_type
@@ -5373,21 +5373,21 @@ int ndo2db_handle_hostgroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND hostgroup_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND hostgroup_object_id=%lu"
,idi->dbinfo.instance_id
,object_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "config_type='%d', alias='%s'"
+ if(asprintf(&buf2, "config_type=%d, alias='%s'"
,idi->current_object_config_type
,es[0]
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, hostgroup_object_id, alias) VALUES ('%lu', '%d', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, config_type, hostgroup_object_id, alias) VALUES (%lu, %d, %lu, '%s')"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -5452,20 +5452,20 @@ int ndo2db_handle_hostgroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "hostgroup_id='%lu' AND host_object_id='%lu'"
+ if(asprintf(&buf1, "hostgroup_id=%lu AND host_object_id=%lu"
,group_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, hostgroup_id, host_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, hostgroup_id, host_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,group_id
,member_id
@@ -5695,7 +5695,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND service_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND service_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -5703,7 +5703,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "host_object_id='%lu', display_name='%s', check_command_object_id='%lu', check_command_args='%s', eventhandler_command_object_id='%lu', eventhandler_command_args='%s', check_timeperiod_object_id='%lu', notif_timeperiod_object_id='%lu', failure_prediction_options='%s', check_interval='%lf', retry_interval='%lf', max_check_attempts='%d', first_notification_delay='%lf', notification_interval='%lf', notify_on_warning='%d', notify_on_unknown='%d', notify_on_critical='%d', notify_on_recovery='%d', notify_on_flapping='%d', notify_on_downtime='%d', stalk_on_ok='%d', stalk_on_warning='%d', stalk_on_unknown='%d', stalk_on_critical='%d', is_volatile='%d', flap_detection_enabled='%d', flap_detection_on_ok='%d', flap_detection_on_warning='%d', flap_detection_on_unknown='%d', flap_detection_on_critical='%d', low_flap_threshold='%lf', high_flap_threshold='%lf', process_performance_data='%d', freshness_checks_enabled='%d', freshness_threshold='%d', passive_checks_enabled='%d', event_handler_enabled='%d', active_checks_enabled='%d', retain_status_information='%d', retain_nonstatus_information='%d', notifications_enabled='%d', obsess_over_service='%d', failure_prediction_enabled='%d', notes='%s', notes_url='%s', action_url='%s', icon_image='%s', icon_image_alt='%s'"
+ if(asprintf(&buf2, "host_object_id=%lu, display_name='%s', check_command_object_id=%lu, check_command_args='%s', eventhandler_command_object_id=%lu, eventhandler_command_args='%s', check_timeperiod_object_id=%lu, notif_timeperiod_object_id=%lu, failure_prediction_options='%s', check_interval=%lf, retry_interval=%lf, max_check_attempts=%d, first_notification_delay=%lf, notification_interval=%lf, notify_on_warning=%d, notify_on_unknown=%d, notify_on_critical=%d, notify_on_recovery=%d, notify_on_flapping=%d, notify_on_downtime=%d, stalk_on_ok=%d, stalk_on_warning=%d, stalk_on_unknown=%d, stalk_on_critical=%d, is_volatile=%d, flap_detection_enabled=%d, flap_detection_on_ok=%d, flap_detection_on_warning=%d, flap_detection_on_unknown=%d, flap_detection_on_critical=%d, low_flap_threshold=%lf, high_flap_threshold=%lf, process_performance_data=%d, freshness_checks_enabled=%d, freshness_threshold=%d, passive_checks_enabled=%d, event_handler_enabled=%d, active_checks_enabled=%d, retain_status_information=%d, retain_nonstatus_information=%d, notifications_enabled=%d, obsess_over_service=%d, failure_prediction_enabled=%d, notes='%s', notes_url='%s', action_url='%s', icon_image='%s', icon_image_alt='%s'"
,host_id
,(es[8]==NULL)?"":es[8]
,check_command_id
@@ -5756,7 +5756,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, host_object_id, service_object_id, display_name, check_command_object_id, check_command_args, eventhandler_command_object_id, eventhandler_command_args, check_timeperiod_object_id, notif_timeperiod_object_id, failure_prediction_options, check_interval, retry_interval, max_check_attempts, first_notification_delay, notification_interval, notify_on_warning, notify_on_unknown, notify_on_critical, notify_on_recovery, notify_on_flapping, notify_on_downtime, stalk_on_ok, stalk_on_warning, stalk_on_unknown, stalk_on_critical, is_volatile, flap_detection_enabled, flap_detection_on_ok, flap_detection_on_warning, flap_detection_on_unknown, flap_detection_on_critical, low_flap_threshold, high_flap_threshold, process_performance_data, freshness_checks_enabled, freshness_threshold, passive_checks_enabled, event_handler_enabled, active_checks_enabled, retain_status_information, retain_nonstatus_information, notifications_enabled, obsess_over_service, failure_prediction_enabled, notes, notes_url, action_url, icon_image, icon_image_alt) VALUES ('%lu', '%d', '%lu', '%lu', '%s', '%lu', '%s', '%lu', '%s', '%lu', '%lu', '%s', '%lf', '%lf', '%d', '%lf', '%lf', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%lf', '%lf', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, config_type, host_object_id, service_object_id, display_name, check_command_object_id, check_command_args, eventhandler_command_object_id, eventhandler_command_args, check_timeperiod_object_id, notif_timeperiod_object_id, failure_prediction_options, check_interval, retry_interval, max_check_attempts, first_notification_delay, notification_interval, notify_on_warning, notify_on_unknown, notify_on_critical, notify_on_recovery, notify_on_flapping, notify_on_downtime, stalk_on_ok, stalk_on_warning, stalk_on_unknown, stalk_on_critical, is_volatile, flap_detection_enabled, flap_detection_on_ok, flap_detection_on_warning, flap_detection_on_unknown, flap_detection_on_critical, low_flap_threshold, high_flap_threshold, process_performance_data, freshness_checks_enabled, freshness_threshold, passive_checks_enabled, event_handler_enabled, active_checks_enabled, retain_status_information, retain_nonstatus_information, notifications_enabled, obsess_over_service, failure_prediction_enabled, notes, notes_url, action_url, icon_image, icon_image_alt) VALUES (%lu, %d, %lu, %lu, '%s', %lu, '%s', %lu, '%s', %lu, %lu, '%s', %lf, %lf, %d, %lf, %lf, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %lf, %lf, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s')"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,host_id
@@ -5869,20 +5869,20 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "service_id='%lu' AND contactgroup_object_id='%lu'"
+ if(asprintf(&buf1, "service_id=%lu AND contactgroup_object_id=%lu"
,service_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, service_id, contactgroup_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, service_id, contactgroup_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,service_id
,member_id
@@ -5930,7 +5930,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND service_id='%lu' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND service_id=%lu AND contact_object_id=%lu"
,idi->dbinfo.instance_id
,service_id
,member_id
@@ -5938,7 +5938,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
buf1=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, service_id, contact_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, service_id, contact_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,service_id
,member_id
@@ -5993,7 +5993,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "object_id='%lu' AND config_type='%d' AND varname='%s'"
+ if(asprintf(&buf1, "object_id=%lu AND config_type=%d AND varname='%s'"
,object_id
,idi->current_object_config_type
,(es[0]==NULL)?"":es[0]
@@ -6001,7 +6001,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', has_been_modified='%d', varvalue='%s'"
+ if(asprintf(&buf2, "instance_id=%lu, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,has_been_modified
,(es[1]==NULL)?"":es[1]
@@ -6009,7 +6009,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu', '%d', '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES (%lu, %lu, %d, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,object_id
,idi->current_object_config_type
@@ -6094,7 +6094,7 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND servicegroup_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND servicegroup_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6108,7 +6108,7 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, servicegroup_object_id, alias) VALUES ('%lu', '%d', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, config_type, servicegroup_object_id, alias) VALUES (%lu, %d, %lu, '%s')"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6178,20 +6178,20 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "servicegroup_id='%lu' AND service_object_id='%lu'"
+ if(asprintf(&buf1, "servicegroup_id=%lu AND service_object_id=%lu"
,group_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, servicegroup_id, service_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, servicegroup_id, service_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,group_id
,member_id
@@ -6281,7 +6281,7 @@ int ndo2db_handle_hostdependencydefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND host_object_id='%lu' AND dependent_host_object_id='%lu' AND dependency_type='%d' AND inherits_parent='%d' AND fail_on_up='%d' AND fail_on_down='%d' AND fail_on_unreachable='%d'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND host_object_id=%lu AND dependent_host_object_id=%lu AND dependency_type=%d AND inherits_parent=%d AND fail_on_up=%d AND fail_on_down=%d AND fail_on_unreachable=%d"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6295,13 +6295,13 @@ int ndo2db_handle_hostdependencydefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "timeperiod_object_id='%lu'"
+ if(asprintf(&buf2, "timeperiod_object_id=%lu"
,timeperiod_object_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, host_object_id, dependent_host_object_id, dependency_type, inherits_parent, timeperiod_object_id, fail_on_up, fail_on_down, fail_on_unreachable) VALUES ('%lu', '%d', '%lu', '%lu', '%d', '%d', '%lu', '%d', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, config_type, host_object_id, dependent_host_object_id, dependency_type, inherits_parent, timeperiod_object_id, fail_on_up, fail_on_down, fail_on_unreachable) VALUES (%lu, %d, %lu, %lu, %d, %d, %lu, %d, %d, %d)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6400,7 +6400,7 @@ int ndo2db_handle_servicedependencydefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND service_object_id='%lu' AND dependent_service_object_id='%lu' AND dependency_type='%d' AND inherits_parent='%d' AND fail_on_ok='%d' AND fail_on_warning='%d' AND fail_on_unknown='%d' AND fail_on_critical='%d'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND service_object_id=%lu AND dependent_service_object_id=%lu AND dependency_type=%d AND inherits_parent=%d AND fail_on_ok=%d AND fail_on_warning=%d AND fail_on_unknown=%d AND fail_on_critical=%d"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6415,13 +6415,13 @@ int ndo2db_handle_servicedependencydefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "timeperiod_object_id='%lu'"
+ if(asprintf(&buf2, "timeperiod_object_id=%lu"
,timeperiod_object_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, service_object_id, dependent_service_object_id, dependency_type, inherits_parent, timeperiod_object_id, fail_on_ok, fail_on_warning, fail_on_unknown, fail_on_critical) VALUES ('%lu', '%d', '%lu', '%lu', '%d', '%d', '%lu', '%d', '%d', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, config_type, service_object_id, dependent_service_object_id, dependency_type, inherits_parent, timeperiod_object_id, fail_on_ok, fail_on_warning, fail_on_unknown, fail_on_critical) VALUES (%lu, %d, %lu, %lu, %d, %d, %lu, %d, %d, %d, %d)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6524,7 +6524,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND host_object_id='%lu' AND timeperiod_object_id='%lu' AND first_notification='%d' AND last_notification='%d'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND host_object_id=%lu AND timeperiod_object_id=%lu AND first_notification=%d AND last_notification=%d"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6535,7 +6535,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "notification_interval='%lf', escalate_on_recovery='%d', escalate_on_down='%d', escalate_on_unreachable='%d'"
+ if(asprintf(&buf2, "notification_interval=%lf, escalate_on_recovery=%d, escalate_on_down=%d, escalate_on_unreachable=%d"
,notification_interval
,escalate_recovery
,escalate_down
@@ -6544,7 +6544,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, host_object_id, timeperiod_object_id, first_notification, last_notification, notification_interval, escalate_on_recovery, escalate_on_down, escalate_on_unreachable) VALUES ('%lu', '%d', '%lu', '%lu', '%d', '%d', '%lf', '%d', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, config_type, host_object_id, timeperiod_object_id, first_notification, last_notification, notification_interval, escalate_on_recovery, escalate_on_down, escalate_on_unreachable) VALUES (%lu, %d, %lu, %lu, %d, %d, %lf, %d, %d, %d)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6613,20 +6613,20 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "hostescalation_id='%lu' AND contactgroup_object_id='%lu'"
+ if(asprintf(&buf1, "hostescalation_id=%lu AND contactgroup_object_id=%lu"
,escalation_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, hostescalation_id, contactgroup_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, hostescalation_id, contactgroup_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,escalation_id
,member_id
@@ -6674,7 +6674,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND hostescalation_id='%lu' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND hostescalation_id=%lu AND contact_object_id=%lu"
,idi->dbinfo.instance_id
,escalation_id
,member_id
@@ -6682,7 +6682,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){
buf1=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, hostescalation_id, contact_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, hostescalation_id, contact_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,escalation_id
,member_id
@@ -6780,7 +6780,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND service_object_id='%lu' AND timeperiod_object_id='%lu' AND first_notification='%d' AND last_notification='%d'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND service_object_id=%lu AND timeperiod_object_id=%lu AND first_notification=%d AND last_notification=%d"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6791,7 +6791,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "notification_interval='%lf', escalate_on_recovery='%d', escalate_on_warning='%d', escalate_on_unknown='%d', escalate_on_critical='%d'"
+ if(asprintf(&buf2, "notification_interval=%lf, escalate_on_recovery=%d, escalate_on_warning=%d, escalate_on_unknown=%d, escalate_on_critical=%d"
,notification_interval
,escalate_recovery
,escalate_warning
@@ -6801,7 +6801,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, service_object_id, timeperiod_object_id, first_notification, last_notification, notification_interval, escalate_on_recovery, escalate_on_warning, escalate_on_unknown, escalate_on_critical) VALUES ('%lu', '%d', '%lu', '%lu', '%d', '%d', '%lf', '%d', '%d', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, config_type, service_object_id, timeperiod_object_id, first_notification, last_notification, notification_interval, escalate_on_recovery, escalate_on_warning, escalate_on_unknown, escalate_on_critical) VALUES (%lu, %d, %lu, %lu, %d, %d, %lf, %d, %d, %d, %d)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -6872,20 +6872,20 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "serviceescalation_id='%lu' AND contactgroup_object_id='%lu'"
+ if(asprintf(&buf1, "serviceescalation_id=%lu AND contactgroup_object_id=%lu"
,escalation_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, serviceescalation_id, contactgroup_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, serviceescalation_id, contactgroup_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,escalation_id
,member_id
@@ -6934,14 +6934,14 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND serviceescalation_id='%lu' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND serviceescalation_id=%lu AND contact_object_id=%lu"
,idi->dbinfo.instance_id
,escalation_id
,member_id
)==-1)
buf1=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, serviceescalation_id, contact_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, serviceescalation_id, contact_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,escalation_id
,member_id
@@ -7014,7 +7014,7 @@ int ndo2db_handle_commanddefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND object_id='%lu' AND config_type='%d'"
+ if(asprintf(&buf1, "instance_id=%lu AND object_id=%lu AND config_type=%d"
,idi->dbinfo.instance_id
,object_id
,idi->current_object_config_type
@@ -7028,7 +7028,7 @@ int ndo2db_handle_commanddefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, config_type, command_line) VALUES ('%lu', '%lu', '%d', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, config_type, command_line) VALUES (%lu, %lu, %d, '%s')"
,idi->dbinfo.instance_id
,object_id
,idi->current_object_config_type
@@ -7115,7 +7115,7 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND timeperiod_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND timeperiod_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -7129,7 +7129,7 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, timeperiod_object_id, alias) VALUES ('%lu', '%d', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, config_type, timeperiod_object_id, alias) VALUES (%lu, %d, %lu, '%s')"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -7206,7 +7206,7 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "timeperiod_id='%lu' AND day='%d' AND start_sec='%lu' AND end_sec='%lu'"
+ if(asprintf(&buf1, "timeperiod_id=%lu AND day=%d AND start_sec=%lu AND end_sec=%lu"
,timeperiod_id
,day
,start_sec
@@ -7215,13 +7215,13 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, timeperiod_id, day, start_sec, end_sec) VALUES ('%lu', '%lu', '%d', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, timeperiod_id, day, start_sec, end_sec) VALUES (%lu, %lu, %d, %lu, %lu)"
,idi->dbinfo.instance_id
,timeperiod_id
,day
@@ -7365,7 +7365,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND contact_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,contact_id
@@ -7373,7 +7373,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "alias='%s', email_address='%s', pager_address='%s', host_timeperiod_object_id='%lu', service_timeperiod_object_id='%lu', host_notifications_enabled='%d', service_notifications_enabled='%d', can_submit_commands='%d', notify_service_recovery='%d', notify_service_warning='%d', notify_service_unknown='%d', notify_service_critical='%d', notify_service_flapping='%d', notify_service_downtime='%d', notify_host_recovery='%d', notify_host_down='%d', notify_host_unreachable='%d', notify_host_flapping='%d', notify_host_downtime='%d'"
+ if(asprintf(&buf2, "alias='%s', email_address='%s', pager_address='%s', host_timeperiod_object_id=%lu, service_timeperiod_object_id=%lu, host_notifications_enabled=%d, service_notifications_enabled=%d, can_submit_commands=%d, notify_service_recovery=%d, notify_service_warning=%d, notify_service_unknown=%d, notify_service_critical=%d, notify_service_flapping=%d, notify_service_downtime=%d, notify_host_recovery=%d, notify_host_down=%d, notify_host_unreachable=%d, notify_host_flapping=%d, notify_host_downtime=%d"
,es[0]
,es[1]
,es[2]
@@ -7397,7 +7397,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, contact_object_id, alias, email_address, pager_address, host_timeperiod_object_id, service_timeperiod_object_id, host_notifications_enabled, service_notifications_enabled, can_submit_commands, notify_service_recovery, notify_service_warning, notify_service_unknown, notify_service_critical, notify_service_flapping, notify_service_downtime, notify_host_recovery, notify_host_down, notify_host_unreachable, notify_host_flapping, notify_host_downtime) VALUES ('%lu', '%d', '%lu', '%s', '%s', '%s', '%lu', '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')"
+ if(asprintf(&buf3,"(instance_id, config_type, contact_object_id, alias, email_address, pager_address, host_timeperiod_object_id, service_timeperiod_object_id, host_notifications_enabled, service_notifications_enabled, can_submit_commands, notify_service_recovery, notify_service_warning, notify_service_unknown, notify_service_critical, notify_service_flapping, notify_service_downtime, notify_host_recovery, notify_host_down, notify_host_unreachable, notify_host_flapping, notify_host_downtime) VALUES (%lu, %d, %lu, '%s', '%s', '%s', %lu, %lu, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,contact_id
@@ -7483,21 +7483,21 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "contact_id='%lu' AND address_number='%d'"
+ if(asprintf(&buf1, "contact_id=%lu AND address_number=%d"
,contact_id
,address_number
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', address='%s'"
+ if(asprintf(&buf2, "instance_id=%lu, address='%s'"
,idi->dbinfo.instance_id
,es[0]
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, contact_id, address_number, address) VALUES ('%lu', '%lu', '%d', '%s')"
+ if(asprintf(&buf3,"(instance_id, contact_id, address_number, address) VALUES (%lu, %lu, %d, '%s')"
,idi->dbinfo.instance_id
,contact_id
,address_number
@@ -7664,7 +7664,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "object_id='%lu' AND config_type='%d' AND varname='%s'"
+ if(asprintf(&buf1, "object_id=%lu AND config_type=%d AND varname='%s'"
,contact_id
,idi->current_object_config_type
,(es[0]==NULL)?"":es[0]
@@ -7672,7 +7672,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu', has_been_modified='%d', varvalue='%s'"
+ if(asprintf(&buf2, "instance_id=%lu, has_been_modified=%d, varvalue='%s'"
,idi->dbinfo.instance_id
,has_been_modified
,(es[1]==NULL)?"":es[1]
@@ -7680,7 +7680,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES ('%lu', '%lu', '%d', '%d', '%s', '%s')"
+ if(asprintf(&buf3,"(instance_id, object_id, config_type, has_been_modified, varname, varvalue) VALUES (%lu, %lu, %d, %d, '%s', '%s')"
,idi->dbinfo.instance_id
,contact_id
,idi->current_object_config_type
@@ -7760,7 +7760,7 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "instance_id='%lu' AND config_type='%d' AND contactgroup_object_id='%lu'"
+ if(asprintf(&buf1, "instance_id=%lu AND config_type=%d AND contactgroup_object_id=%lu"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -7774,7 +7774,7 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, config_type, contactgroup_object_id, alias) VALUES ('%lu', '%d', '%lu', '%s')"
+ if(asprintf(&buf3,"(instance_id, config_type, contactgroup_object_id, alias) VALUES (%lu, %d, %lu, '%s')"
,idi->dbinfo.instance_id
,idi->current_object_config_type
,object_id
@@ -7839,20 +7839,20 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){
free(buf1);
#else
/* Unique constraint, upon match with these columns an UPDATE takes place, an INSERT otherwise */
- if(asprintf(&buf1, "contactgroup_id='%lu' AND contact_object_id='%lu'"
+ if(asprintf(&buf1, "contactgroup_id=%lu AND contact_object_id=%lu"
,group_id
,member_id
)==-1)
buf1=NULL;
/* Values to set when updating */
- if(asprintf(&buf2, "instance_id='%lu'"
+ if(asprintf(&buf2, "instance_id=%lu"
,idi->dbinfo.instance_id
)==-1)
buf2=NULL;
/* the data part of the INSERT statement */
- if(asprintf(&buf3,"(instance_id, contactgroup_id, contact_object_id) VALUES ('%lu', '%lu', '%lu')"
+ if(asprintf(&buf3,"(instance_id, contactgroup_id, contact_object_id) VALUES (%lu, %lu, %lu)"
,idi->dbinfo.instance_id
,group_id
,member_id