zoukankan      html  css  js  c++  java
  • c怎么调用查询构建器

    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!
    ");
    		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 
    ");
    	}
    	if (n_found>0)
    	{
    		WriteLog( "查找到了工序版本对象
    ");
    		for(int i=0;i<n_found;i++){
    			oprevision_tags.push_back(item_tags[i]);
    		}
    	}else{
    		WriteLog( "没有查找到工序版本对象
    ");
    	}
    
    	DOFREE(item_tags);
    
    	return ITK_ok;
    }
    

      

  • 相关阅读:
    redis实现与分析
    NULL, '',0 '0'的区别
    Linux strace命令
    strcpy和memcpy的区别
    图书推荐
    php与mysql通讯那点事
    linux命令汇总
    linux系统信息查询及相关概念
    LNMP zabbix安装
    lftp查看文件时间与登录服务查看文件时间相差8小时
  • 原文地址:https://www.cnblogs.com/wwssgg/p/15261210.html
Copyright © 2011-2022 走看看