ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

c怎么调用查询构建器

2021-09-13 10:32:03  阅读:167  来源: 互联网

标签:调用 tags int values 查询 char 构建 entries query


int   
	n_entries = 1, 
	n_found = 0,
	n_contents = 0;
tag_t 
	query = NULLTAG, 
	items = NULLTAG,
	*item_tags = NULL;
char
	**entries = NULL, 
	**values = NULL;
QRY_find("Item...", &query);
entries = (char **) MEM_alloc(1 * sizeof(char *));
entries[0] = (char *)MEM_alloc(strlen("ItemID") + 1);
strcpy(entries[0], "ItemID");
values  = (char **) MEM_alloc(1 * sizeof(char *));
values[0] = (char *)MEM_alloc( strlen(item_id) + 1);
QRY_execute(query, n_entries, entries, values, &n_found, &item_tags);

int query_oprevision_tags(char* query_value,logical is_gyxz,vector<tag_t> &oprevision_tags)
{
	int   
		n_entries = 1, 
		n_found = 0,
		n_contents = 0;
	tag_t 
		query = NULLTAG, 
		items = NULLTAG,
		*item_tags = NULL;
	char
		**entries = NULL, 
		**values = NULL;

	 int num_clauses=0;
	 char**  attr_names;
	 char** entry_names;
	 char** logical_ops;
	 char** math_ops;
	 char** default_values;
	 tag_t *lov_tags;
	 int* attr_types;

	
	ITKCALL(QRY_find("0__find_oprevision", &query));
	entries = (char **) MEM_alloc(1 * sizeof(char *));
	values  = (char **) MEM_alloc(1 * sizeof(char *));
	
	values[0] = (char *)MEM_alloc(strlen(query_value) + 1);
	strcpy(values[0],query_value);
	if(query != NULLTAG){
		ITKCALL(QRY_describe_query(query,&num_clauses,&attr_names,&entry_names,&logical_ops,&math_ops,&default_values,&lov_tags,&attr_types));
		for(int n=0;n<num_clauses;n++)
		{
			if(strcmp(attr_names[n], "c8_gyxz_no") == 0 && is_gyxz){
				entries[0] = (char *)MEM_alloc(strlen("c8_gyxz_no") + 1);
				strcpy(entries[0], entry_names[n]);
			} else if (strcmp(attr_names[n], "c8_common_no") == 0 && (!is_gyxz)){
				entries[0] = (char *)MEM_alloc(strlen("c8_common_no") + 1);
				strcpy(entries[0], entry_names[n]);
			}
		}
		WriteLog( "Query is Exist!\n");
		ITKCALL(QRY_execute(query, n_entries, entries, values, &n_found, &item_tags));

		DOFREE(attr_names);
		DOFREE(entry_names);
		DOFREE(logical_ops);
		DOFREE(math_ops);
		DOFREE(default_values);
		DOFREE(lov_tags);
		DOFREE(attr_types);

	}else{
		WriteLog( "Query is NULL \n");
	}
	if (n_found>0)
	{
		WriteLog( "查找到了工序版本对象\n");
		for(int i=0;i<n_found;i++){
			oprevision_tags.push_back(item_tags[i]);
		}
	}else{
		WriteLog( "没有查找到工序版本对象\n");
	}

	DOFREE(item_tags);

	return ITK_ok;
}

  

标签:调用,tags,int,values,查询,char,构建,entries,query
来源: https://www.cnblogs.com/wwssgg/p/15261210.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有