您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DBexecute函数代码示例

51自学网 2021-06-01 20:18:47
  C++
这篇教程C++ DBexecute函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DBexecute函数的典型用法代码示例。如果您正苦于以下问题:C++ DBexecute函数的具体用法?C++ DBexecute怎么用?C++ DBexecute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DBexecute函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: housekeeping_events

static int	housekeeping_events(int now){	const char	*__function_name = "housekeeping_events";	int		event_history, deleted = 0;	DB_RESULT	result;	DB_ROW		row;	zbx_uint64_t	eventid;	zabbix_log(LOG_LEVEL_DEBUG, "In %s() now:%d", __function_name, now);	result = DBselect("select eventid from events where clock<%d",			now - *(int *)DCconfig_get_config_data(&event_history, CONFIG_EVENT_HISTORY) * SEC_PER_DAY);	while (NULL != (row = DBfetch(result)))	{		ZBX_STR2UINT64(eventid, row[0]);		DBexecute("delete from acknowledges where eventid=" ZBX_FS_UI64, eventid);		deleted += DBexecute("delete from events where eventid=" ZBX_FS_UI64, eventid);	}	DBfree_result(result);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%d", __function_name, deleted);	return deleted;}
开发者ID:nabnut,项目名称:zabbix2.0-cookies,代码行数:26,


示例2: update_checksums

/****************************************************************************** *                                                                            * * Function: update_checksums                                                 * *                                                                            * * Purpose: overwrite old checksums with new ones                             * *                                                                            * * Parameters:                                                                * *                                                                            * * Return value: SUCCESS - calculated succesfully                             * *               FAIL - an error occured                                      * *                                                                            * * Author: Alexei Vladishev                                                   * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/static int update_checksums(){    DBexecute("delete from node_cksum where cksumtype=%d",              NODE_CKSUM_TYPE_OLD);    DBexecute("update node_cksum set cksumtype=%d where cksumtype=%d",              NODE_CKSUM_TYPE_OLD,              NODE_CKSUM_TYPE_NEW);    return SUCCEED;}
开发者ID:Shmuma,项目名称:z,代码行数:26,


示例3: housekeeping_process_log

/****************************************************************************** *                                                                            * * Function: housekeeping_process_log                                         * *                                                                            * * Purpose: process table 'housekeeper' and remove data if required           * *                                                                            * * Parameters:                                                                * *                                                                            * * Return value: SUCCEED - information removed succesfully                    * *               FAIL - otherwise                                             * *                                                                            * * Author: Alexei Vladishev                                                   * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/static int housekeeping_process_log(){	DB_HOUSEKEEPER	housekeeper;	DB_RESULT	result;	DB_ROW		row;	int		res = SUCCEED;	long		deleted;	zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_process_log()");	/* order by tablename to effectively use DB cache */	result = DBselect("select housekeeperid, tablename, field, value from housekeeper order by tablename");	while((row=DBfetch(result)))	{		ZBX_STR2UINT64(housekeeper.housekeeperid,row[0]);		housekeeper.tablename=row[1];		housekeeper.field=row[2];		ZBX_STR2UINT64(housekeeper.value,row[3]);#ifdef HAVE_ORACLE		deleted = DBexecute("delete from %s where %s=" ZBX_FS_UI64 " and rownum<500",			housekeeper.tablename,			housekeeper.field,			housekeeper.value);#elif defined(HAVE_POSTGRESQL)		deleted = DBexecute("delete from %s where oid in (select oid from %s where %s=" ZBX_FS_UI64 " limit 500)",				housekeeper.tablename, 				housekeeper.tablename, 				housekeeper.field,				housekeeper.value);#else		deleted = DBexecute("delete from %s where %s=" ZBX_FS_UI64 " limit 500",			housekeeper.tablename,			housekeeper.field,			housekeeper.value);#endif		if(deleted == 0)		{			DBexecute("delete from housekeeper where housekeeperid=" ZBX_FS_UI64,				housekeeper.housekeeperid);		}		else		{			zabbix_log( LOG_LEVEL_DEBUG, "Deleted [%ld] records from table [%s]",				deleted,				housekeeper.tablename);		}	}	DBfree_result(result);	return res;}
开发者ID:Shmuma,项目名称:z,代码行数:71,


示例4: process_deleted_records

/****************************************************************************** *                                                                            * * Function: process_deleted_records                                          * *                                                                            * * Purpose:                                                                   * *                                                                            * * Parameters:                                                                * *                                                                            * * Return value:                                                              * *                                                                            * * Author: Alexander Vladishev                                                * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/static void	process_deleted_records(int nodeid, char *data, int sender_nodetype){	const char	*__function_name = "process_deleted_records";	char		*r, *lf;	const ZBX_TABLE	*table = NULL;	zbx_uint64_t	recid, *ids = NULL;	int		ids_alloc = 0, ids_num = 0;	char		*sql = NULL;	size_t		sql_alloc = 4 * ZBX_KIBIBYTE, sql_offset = 0;	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);	sql = zbx_malloc(sql, sql_alloc);	DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);	for (r = data; '/0' != *r;)	{		if (NULL != (lf = strchr(r, '/n')))			*lf = '/0';		zbx_get_next_field((const char **)&r, &buf, &buf_alloc, ZBX_DM_DELIMITER);		if (NULL == table || 0 != strcmp(table->table, buf))		{			make_delete_sql(&sql, &sql_alloc, &sql_offset, table, ids, &ids_num);			if (NULL == (table = DBget_table(buf)))			{				zabbix_log(LOG_LEVEL_DEBUG, "%s(): cannot find table [%s]", __function_name, buf);				goto next;			}		}		zbx_get_next_field((const char **)&r, &buf, &buf_alloc, ZBX_DM_DELIMITER);		ZBX_STR2UINT64(recid, buf);		if ('2' == *r)	/* NODE_CONFIGLOG_OP_DELETE */			uint64_array_add(&ids, &ids_alloc, &ids_num, recid, 64);next:		if (lf != NULL)		{			*lf++ = '/n';			r = lf;		}		else			break;	}	make_delete_sql(&sql, &sql_alloc, &sql_offset, table, ids, &ids_num);	DBend_multiple_update(&sql, &sql_alloc, &sql_offset);	if (sql_offset > 16)	/* In ORACLE always present begin..end; */		DBexecute("%s", sql);	zbx_free(sql);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);}
开发者ID:gheja,项目名称:zabbix-ext,代码行数:75,


示例5: ja_host_lock

/****************************************************************************** *                                                                            * * Function:                                                                  * *                                                                            * * Purpose:                                                                   * *                                                                            * * Parameters:                                                                * *                                                                            * * Return value:                                                              * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/int ja_host_lock(const char *host, const zbx_uint64_t inner_job_id){    int db_ret;    char *host_esc;    const char *__function_name = "ja_host_lock";    zabbix_log(LOG_LEVEL_DEBUG, "In %s() host: %s", __function_name, host);    if (ja_host_getip(host, NULL, inner_job_id, NULL, JA_TXN_ON) == 0)        return FAIL;    DBfree_result(DBselect                  ("select lock_host_name from ja_host_lock_table where lock_host_name = 'HOST_LOCK_RECORD' for update"));    host_esc = DBdyn_escape_string(host);    db_ret =        DBexecute        ("insert into ja_host_lock_table (lock_host_name) values ('%s')",         host_esc);    zbx_free(host_esc);    if (db_ret < ZBX_DB_OK) {        ja_log("JAHOST200005", 0, NULL, inner_job_id, __function_name, host, inner_job_id);        return FAIL;    } else {        return SUCCEED;    }}
开发者ID:hatta0713,项目名称:jobarranger,代码行数:41,


示例6: DBpatch_2030113

static int	DBpatch_2030113(void){	if (ZBX_DB_OK > DBexecute("delete from profiles where idx in ('web.latest.php.sort', 'web.httpmon.php.sort')"))		return FAIL;	return SUCCEED;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:7,


示例7: DBpatch_2030028

static int	DBpatch_2030028(void){	if (ZBX_DB_OK > DBexecute("update items set formula='' where flags=%d", ZBX_FLAG_DISCOVERY_RULE))		return FAIL;	return SUCCEED;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:7,


示例8: op_host_disable

/****************************************************************************** *                                                                            * * Function: op_host_disable                                                  * *                                                                            * * Purpose: disable host                                                      * *                                                                            * * Author: Alexander Vladishev                                                * *                                                                            * ******************************************************************************/void	op_host_disable(DB_EVENT *event){	const char	*__function_name = "op_host_disable";	zbx_uint64_t	hostid;	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);	if (event->source != EVENT_SOURCE_DISCOVERY && event->source != EVENT_SOURCE_AUTO_REGISTRATION)		return;	if (event->object != EVENT_OBJECT_DHOST && event->object != EVENT_OBJECT_DSERVICE && event->object != EVENT_OBJECT_ZABBIX_ACTIVE)		return;	if (0 == (hostid = add_discovered_host(event)))		return;	DBexecute(			"update hosts"			" set status=%d"			" where hostid=" ZBX_FS_UI64,			HOST_STATUS_NOT_MONITORED,			hostid);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);}
开发者ID:baniuyao,项目名称:Zabbix_PPTV,代码行数:34,


示例9: zbx_db_init

void	zbx_db_init(char *dbname){#if defined(HAVE_SQLITE3)	struct stat	buf;	if (0 != stat(dbname, &buf))	{		zabbix_log(LOG_LEVEL_WARNING, "cannot open database file /"%s/": %s", dbname, zbx_strerror(errno));		zabbix_log(LOG_LEVEL_WARNING, "creating database ...");		if (SQLITE_OK != sqlite3_open(dbname, &conn))		{			zabbix_errlog(ERR_Z3002, dbname, 0, sqlite3_errmsg(conn));			exit(FAIL);		}		zbx_create_sqlite3_mutex(dbname);		DBexecute("%s", db_schema);		DBclose();	}	else		zbx_create_sqlite3_mutex(dbname);#endif	/* HAVE_SQLITE3 */}
开发者ID:hatta0713,项目名称:jobarranger,代码行数:26,


示例10: DBpatch_2010068

static int	DBpatch_2010068(void){	if (ZBX_DB_OK <= DBexecute(			"update config"			" set hk_events_mode=0,"				"hk_services_mode=0,"				"hk_audit_mode=0,"				"hk_sessions_mode=0,"				"hk_history_mode=0,"				"hk_trends_mode=0,"				"hk_events_trigger="					"case when event_history>alert_history"					" then event_history else alert_history end,"				"hk_events_discovery="					"case when event_history>alert_history"					" then event_history else alert_history end,"				"hk_events_autoreg="					"case when event_history>alert_history"					" then event_history else alert_history end,"				"hk_events_internal="					"case when event_history>alert_history"					" then event_history else alert_history end"))	{		return SUCCEED;	}	return FAIL;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:28,


示例11: register_host

/****************************************************************************** *                                                                            * * Function: register_host                                                    * *                                                                            * * Purpose: register host if one does not exist                               * *                                                                            * * Parameters: host ip address                                                * *                                                                            * * Return value: dhostid or 0 if we didn't add host                           * *                                                                            * * Author: Alexei Vladishev                                                   * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/static void register_host(DB_DHOST *host,DB_DCHECK *check, zbx_uint64_t druleid, char *ip){	DB_RESULT	result;	DB_ROW		row;	char		hostname[MAX_STRING_LEN], hostname_esc[MAX_STRING_LEN];	assert(host);	assert(check);	assert(ip);	zabbix_log(LOG_LEVEL_DEBUG, "In register_host(ip:%s)",		ip);	host->dhostid=0;	result = DBselect("select dhostid,druleid,ip,status,lastup,lastdown from dhosts where ip='%s'", ip);	row=DBfetch(result);	if(!row || DBis_null(row[0])==SUCCEED)	{		/* Add host only if service is up */		if(check->status == DOBJECT_STATUS_UP)		{			alarm(CONFIG_TIMEOUT);			zbx_gethost_by_ip(ip, hostname, sizeof(hostname));			alarm(0);			if (hostname[0] != '/0')				DBescape_string(hostname, hostname_esc, sizeof(hostname_esc));			else				hostname_esc[0] = '/0';			zabbix_log(LOG_LEVEL_DEBUG, "New host discovered at %s (%s)",				ip, hostname);			host->dhostid = DBget_maxid("dhosts","dhostid");			DBexecute("insert into dhosts (dhostid, druleid, dns, ip) values (" ZBX_FS_UI64 "," ZBX_FS_UI64 ", '%s','%s')",				host->dhostid,				druleid,				hostname_esc,				ip);			host->druleid	= druleid;			strscpy(host->ip,ip);			host->status	= 0;			host->lastup	= 0;			host->lastdown  = 0;		}	}	else	{		zabbix_log(LOG_LEVEL_DEBUG, "Host is already in database");		ZBX_STR2UINT64(host->dhostid,row[0]);		ZBX_STR2UINT64(host->druleid,row[1]);		strscpy(host->ip,	row[2]);		host->status		= atoi(row[3]);		host->lastup		= atoi(row[4]);		host->lastdown		= atoi(row[5]);	}	DBfree_result(result);	zabbix_log(LOG_LEVEL_DEBUG, "End register_host()");}
开发者ID:Shmuma,项目名称:z,代码行数:75,


示例12: DBpatch_2010037

static int	DBpatch_2010037(void){	if (ZBX_DB_OK <= DBexecute("update config set server_check_interval=10"))		return SUCCEED;	return FAIL;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:7,


示例13: DBpatch_2010050

static int	DBpatch_2010050(void){	char		*fields[] = {"ts_from", "ts_to", NULL};	DB_RESULT	result;	DB_ROW		row;	int		i;	time_t		ts;	struct tm	*tm;	for (i = 0; NULL != fields[i]; i++)	{		result = DBselect(				"select timeid,%s"				" from services_times"				" where type in (%d,%d)"					" and %s>%d",				fields[i], 0 /* SERVICE_TIME_TYPE_UPTIME */, 1 /* SERVICE_TIME_TYPE_DOWNTIME */,				fields[i], SEC_PER_WEEK);		while (NULL != (row = DBfetch(result)))		{			if (SEC_PER_WEEK < (ts = (time_t)atoi(row[1])))			{				tm = localtime(&ts);				ts = tm->tm_wday * SEC_PER_DAY + tm->tm_hour * SEC_PER_HOUR + tm->tm_min * SEC_PER_MIN;				DBexecute("update services_times set %s=%d where timeid=%s",						fields[i], (int)ts, row[0]);			}		}		DBfree_result(result);	}	return SUCCEED;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:34,


示例14: DBpatch_2010185

static int	DBpatch_2010185(void){	if (ZBX_DB_OK > DBexecute("update sysmaps_elements set label_location=-1 where label_location is null"))		return FAIL;	return SUCCEED;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:7,


示例15: DBpatch_2010176

static int	DBpatch_2010176(void){	DB_RESULT	result;	DB_ROW		row;	char		*name, *name_esc;	int		ret = SUCCEED;	result = DBselect("select scriptid,name from scripts");	while (SUCCEED == ret && NULL != (row = DBfetch(result)))	{		name = zbx_dyn_escape_string(row[1], "///");		if (0 != strcmp(name, row[1]))		{			name_esc = DBdyn_escape_string_len(name, 255);			if (ZBX_DB_OK > DBexecute("update scripts set name='%s' where scriptid=%s", name_esc, row[0]))				ret = FAIL;			zbx_free(name_esc);		}		zbx_free(name);	}	DBfree_result(result);	return ret;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:29,


示例16: DBpatch_2030065

static int	DBpatch_2030065(void){	DB_RESULT	result;	DB_ROW		row;	int		local_nodeid = 0;	zbx_uint64_t	min, max;	/* 1 - ZBX_NODE_LOCAL */	if (NULL == (result = DBselect("select nodeid from nodes where nodetype=1")))		return FAIL;	if (NULL != (row = DBfetch(result)))		local_nodeid = atoi(row[0]);	DBfree_result(result);	if (0 == local_nodeid)		return SUCCEED;	min = local_nodeid * __UINT64_C(100000000000000);	max = min + __UINT64_C(100000000000000) - 1;	if (ZBX_DB_OK <= DBexecute(			"delete from config where not configid between " ZBX_FS_UI64 " and " ZBX_FS_UI64, min, max))	{		return SUCCEED;	}	return FAIL;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:29,


示例17: DBcreate_dbversion_table

static int	DBcreate_dbversion_table(void){	const ZBX_TABLE	table =			{"dbversion", "", 0,				{					{"mandatory", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},					{"optional", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},					{NULL}				}			};	int		ret;	DBbegin();	if (SUCCEED == (ret = DBcreate_table(&table)))	{		if (ZBX_DB_OK > DBexecute("insert into dbversion (mandatory,optional) values (%d,%d)",				ZBX_FIRST_DB_VERSION, ZBX_FIRST_DB_VERSION))		{			ret = FAIL;		}	}	DBend(ret);	return ret;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:25,


示例18: DBpatch_2010080

static int	DBpatch_2010080(void){	DB_RESULT	result;	DB_ROW		row;	zbx_uint64_t	applicationid, templateid, application_templateid = 1;	int		ret = FAIL;	result = DBselect("select applicationid,templateid from applications where templateid is not null");	while (NULL != (row = DBfetch(result)))	{		ZBX_STR2UINT64(applicationid, row[0]);		ZBX_STR2UINT64(templateid, row[1]);		if (ZBX_DB_OK > DBexecute(				"insert into application_template"					" (application_templateid,applicationid,templateid)"					" values (" ZBX_FS_UI64 "," ZBX_FS_UI64 "," ZBX_FS_UI64 ")",				application_templateid++, applicationid, templateid))		{			goto out;		}	}	ret = SUCCEED;out:	DBfree_result(result);	return ret;}
开发者ID:HupuInc,项目名称:zabbix,代码行数:30,


示例19: tm_remove_old_tasks

/****************************************************************************** *                                                                            * * Function: tm_remove_old_tasks                                              * *                                                                            * * Purpose: remove old done/expired tasks                                     * *                                                                            * ******************************************************************************/static void	tm_remove_old_tasks(int now){	DBbegin();	DBexecute("delete from task where status in (%d,%d) and clock<=%d",			ZBX_TM_STATUS_DONE, ZBX_TM_STATUS_EXPIRED, now - ZBX_TM_CLEANUP_TASK_AGE);	DBcommit();}
开发者ID:zabbix,项目名称:zabbix,代码行数:14,


示例20: housekeeping_alerts

static int housekeeping_alerts(int now){	int	alert_history;	DB_RESULT	result;	DB_ROW		row;	int		res = SUCCEED;	int		deleted;	zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_alerts(%d)",		now);	result = DBselect("select alert_history from config");	row=DBfetch(result);	if(!row || DBis_null(row[0])==SUCCEED)	{		zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'.");		res = FAIL;	}	else	{		alert_history=atoi(row[0]);		deleted = DBexecute("delete from alerts where clock<%d",			now-24*3600*alert_history);		zabbix_log( LOG_LEVEL_DEBUG, "Deleted [%ld] records from table [alerts]",			deleted);	}	DBfree_result(result);	return res;}
开发者ID:Shmuma,项目名称:z,代码行数:33,


示例21: add_command_alert

static void	add_command_alert(DB_ESCALATION *escalation, DB_EVENT *event, DB_ACTION *action, char *command){	zbx_uint64_t	alertid;	int		now;	char		*command_esc;	zabbix_log(LOG_LEVEL_DEBUG, "In add_command_alert()");	alertid		= DBget_maxid("alerts", "alertid");	now		= time(NULL);	command_esc	= DBdyn_escape_string(command);	DBexecute("insert into alerts (alertid,actionid,eventid,clock,message,status,alerttype,esc_step)"			" values (" ZBX_FS_UI64 "," ZBX_FS_UI64 "," ZBX_FS_UI64 ",%d,'%s',%d,%d,%d)",			alertid,			action->actionid,			event->eventid,			now,			command_esc,			ALERT_STATUS_SENT,			ALERT_TYPE_COMMAND,			escalation->esc_step);	op_run_commands(command);	zbx_free(command_esc);}
开发者ID:phedders,项目名称:zabbix,代码行数:27,


示例22: housekeeping_events

static int housekeeping_events(int now){	int		event_history;	DB_RESULT	result;	DB_ROW		row1;	int		res = SUCCEED;	zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_events(%d)",		now);	result = DBselect("select event_history from config");	row1=DBfetch(result);		if(!row1 || DBis_null(row1[0])==SUCCEED)	{		zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'.");		res = FAIL;	}	else	{		event_history=atoi(row1[0]);		DBexecute ("delete from events where clock < %d", now-24*3600*event_history);	}		DBfree_result(result);	return res;}
开发者ID:Shmuma,项目名称:z,代码行数:28,


示例23: op_group_del

/****************************************************************************** *                                                                            * * Function: op_group_del                                                     * *                                                                            * * Purpose: delete group from discovered host                                 * *                                                                            * * Parameters: event   - [IN] event data                                      * *             groupid - [IN] group identificator from database               * *                                                                            * * Author: Alexei Vladishev                                                   * *                                                                            * ******************************************************************************/void	op_group_del(DB_EVENT *event, zbx_uint64_t groupid){	const char	*__function_name = "op_group_del";	zbx_uint64_t	hostid;	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);	if (event->source != EVENT_SOURCE_DISCOVERY)		return;	if (event->object != EVENT_OBJECT_DHOST && event->object != EVENT_OBJECT_DSERVICE)		return;	if (0 == (hostid = select_discovered_host(event)))		return;	DBexecute(			"delete from hosts_groups"			" where hostid=" ZBX_FS_UI64				" and groupid=" ZBX_FS_UI64,			hostid,			groupid);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);}
开发者ID:baniuyao,项目名称:Zabbix_PPTV,代码行数:37,


示例24: add_command_alert

static void	add_command_alert(DC_HOST *host, zbx_uint64_t eventid, zbx_uint64_t actionid,		int esc_step, const char *command, zbx_alert_status_t status, const char *error){	const char	*__function_name = "add_command_alert";	zbx_uint64_t	alertid;	int		now;	char		*tmp = NULL, *command_esc, *error_esc;	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);	alertid = DBget_maxid("alerts");	now = (int)time(NULL);	tmp = zbx_dsprintf(tmp, "%s:%s", host->host, NULL == command ? "" : command);	command_esc = DBdyn_escape_string_len(tmp, ALERT_MESSAGE_LEN);	error_esc = DBdyn_escape_string_len(error, ALERT_ERROR_LEN);	zbx_free(tmp);	DBexecute("insert into alerts"			" (alertid,actionid,eventid,clock,message,status,error,alerttype,esc_step)"			" values "			"(" ZBX_FS_UI64 "," ZBX_FS_UI64 "," ZBX_FS_UI64 ",%d,'%s',%d,'%s',%d,%d)",			alertid, actionid, eventid, now, command_esc, (int)status,			error_esc, ALERT_TYPE_COMMAND, esc_step);	zbx_free(error_esc);	zbx_free(command_esc);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:29,


示例25: DBpatch_2030110

static int	DBpatch_2030110(void){	if (ZBX_DB_OK > DBexecute("delete from profiles where idx='web.view.application'"))		return FAIL;	return SUCCEED;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:7,


示例26: delete_history

/****************************************************************************** *                                                                            * * Function: delete_history                                                   * *                                                                            * * Purpose: remove outdated information from historical table                 * *                                                                            * * Parameters: now - current timestamp                                        * *                                                                            * * Return value: number of rows deleted                                       * *                                                                            * * Author: Alexei Vladishev                                                   * *                                                                            * * Comments:                                                                  * *                                                                            * ******************************************************************************/static int	delete_history(const char *table, zbx_uint64_t itemid, int keep_history, int now){	const char	*__function_name = "delete_history";	DB_RESULT       result;	DB_ROW          row;	int             min_clock, deleted;	zabbix_log(LOG_LEVEL_DEBUG, "In %s() table:'%s' itemid:" ZBX_FS_UI64 " keep_history:%d now:%d",		__function_name, table, itemid, keep_history, now);	result = DBselect("select min(clock) from %s where itemid=" ZBX_FS_UI64, table, itemid);	if (NULL == (row = DBfetch(result)) || SUCCEED == DBis_null(row[0]))	{		DBfree_result(result);		return 0;	}	min_clock = atoi(row[0]);	min_clock = MIN(now - keep_history * SEC_PER_DAY, min_clock + 4 * CONFIG_HOUSEKEEPING_FREQUENCY * SEC_PER_HOUR);	DBfree_result(result);	deleted = DBexecute("delete from %s where itemid=" ZBX_FS_UI64 " and clock<%d", table, itemid, min_clock);	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%d", __function_name, deleted);	return deleted;}
开发者ID:nabnut,项目名称:zabbix2.0-cookies,代码行数:43,


示例27: DBpatch_2030114

static int	DBpatch_2030114(void){	if (ZBX_DB_OK > DBexecute("delete from profiles where idx='web.httpconf.php.sort' and value_str='h.hostid'"))		return FAIL;	return SUCCEED;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:7,


示例28: DBpatch_2030109

static int	DBpatch_2030109(void){	if (ZBX_DB_OK <= DBexecute("update screens_items set rowspan=1 where rowspan=0"))		return SUCCEED;	return FAIL;}
开发者ID:AdamBalali,项目名称:zabbix-agent-xxl,代码行数:7,



注:本文中的DBexecute函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DBfree_result函数代码示例
C++ DB_t_tif_tradeserial_add函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。