示例#1
0
文件: main.cpp 项目: top/posix_ccpp
int main(int argc, char *argv[]) {
    CConfig cfg;
    if (cfg.LoadXML(XML_CONFIG_FILE) != 0) return -1;

    char res[100] = {0};
    char id_name[20] = {0};
    vector<_T_INDEX> idx;
    if (cfg.GetIndexesFromXML("ca_product_detail", "attribute", id_name, idx) != 0) return -1;

    vector<_T_INDEX> result;
    if (cfg.GetRecords("ca_product_detail", "product_id", "attribute", result, 0) != 0) return -1;

    vector<_T_RECORD> idx2v;
    for (int i  = 0; i < result.size(); i++) {
		_T_RECORD idx2;
		if (cfg.ParseRecords(result[i], idx, idx2) != 0) return -1;
		idx2v.push_back(idx2);
    }
    Debug << "field count: " << idx.size() << ", data_count: " << idx2v.size();
    if (cfg.FullQuantityUpdate(idx, idx2v, "result.xml") != 0) return -1;

	return 0;
}