[Refdb-cvs] CVS: refdb/src mods_checkdup.c,1.1,1.2
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-07-15 20:34:30
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18474 Modified Files: mods_checkdup.c Log Message: assorted attempts to get the name and titleinfo stuff going Index: mods_checkdup.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/mods_checkdup.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -U2 -r1.1 -r1.2 --- mods_checkdup.c 20 Jun 2004 21:42:51 -0000 1.1 +++ mods_checkdup.c 15 Jul 2004 20:34:21 -0000 1.2 @@ -100,4 +100,5 @@ size_t sql_cmd_len; unsigned long long n_titleinfo_id = 0; + unsigned long long n_titleparts_id = 0; struct lilimem sentinel; struct titleinfo_lists* ptr_titleinfolists; @@ -108,5 +109,5 @@ dbi_driver driver; -/* printf("process %s with parent %s\n", ptr_titleinfo->objectName, ptr_titleinfo->parent); */ + printf("process %s with parent %s\n", ptr_titleinfo->objectName, ptr_titleinfo->parent); sentinel.ptr_mem = NULL; @@ -309,4 +310,6 @@ goto finish; } + + printf("prepare SQL command 1\n"); /* assemble sql command */ @@ -360,6 +363,6 @@ goto finish; } - - sprintf(sql_command, "SELECT titleparts_id FROM t_titleparts WHERE titleparts_value=%s AND titleparts_type=\'%s\' AND titleinfo_id="ULLSPEC"", value_q, ptr_curr_content->name, n_titleinfo_id); + /* todo: titleinfo_id IN () ? */ + sprintf(sql_command, "SELECT titleparts_id FROM t_titleparts WHERE titleparts_value=%s AND titleparts_type=\'%s\' AND titleinfo_id IN (%s)", value_q, ptr_curr_content->name, lilid_to_string(&(ptr_titleinfolists->titleinfo))); free(value_q); @@ -378,6 +381,5 @@ IDs for the duplicate check */ while (dbi_result_next_row(dbires)) { - /* abuse n_subject_id */ - n_titleinfo_id = dbi_result_get_ulonglong_idx(dbires, 1); + n_titleparts_id = dbi_result_get_ulonglong_idx(dbires, 1); if (dbi_conn_error_flag(dbi_result_get_conn(dbires))) { continue; @@ -400,4 +402,5 @@ } + printf("result went to %d<<\n", result); if (result) { n_titleinfo_id = 0; @@ -420,5 +423,5 @@ /* now we've got the bits and pieces. Assemble a monster query */ - sprintf(sql_command, "SELECT titleinfo_id FROM t_titleinfo, t_titleparts WHERE t_titleinfo.titleinfo_id IN (%s)", lilid_to_string(&(ptr_titleinfolists->titleinfo))); + sprintf(sql_command, "SELECT t_titleinfo.titleinfo_id FROM t_titleinfo, t_titleparts WHERE t_titleinfo.titleinfo_id IN (%s)", lilid_to_string(&(ptr_titleinfolists->titleinfo))); for (i=0;i<5;i++) { @@ -446,5 +449,7 @@ } + /* todo: if the list contains no entry, select for count()=0 */ while ((ptr_curr_lilid = get_next_lilid(ptr_curr_lilid)) != NULL) { + printf("in while loop\n"); sprintf(buffer, " AND t_titleparts.titleparts_id="ULLSPEC" AND t_titleparts.titleparts_type=\'%s\' AND t_titleparts.titleinfo_id=t_titleinfo.titleinfo_id ", ptr_curr_lilid->value, type); new_sql_command = mstrcat(sql_command, buffer, &sql_cmd_len, 0); @@ -868,5 +873,5 @@ } else if (!strcmp(ptr_curr_content->name, "namePart")) { - sprintf(sql_command, "SELECT namepart_id FROM t_nameparts WHERE nameparts_value%s%s AND nameparts_type%s%s AND nameparts_pos%s%s", value_op, value_q, attvalue_op, attvalue_q, attvalue1_op, attvalue1_q); + sprintf(sql_command, "SELECT nameparts_id FROM t_nameparts WHERE nameparts_value%s%s AND nameparts_type%s%s AND nameparts_pos%s%s", value_op, value_q, attvalue_op, attvalue_q, attvalue1_op, attvalue1_q); } else { /* displayForm, affiliation, description */ @@ -930,5 +935,5 @@ /* now we've got the bits and pieces. Assemble a monster query */ - sprintf(sql_command, "SELECT name_id FROM t_name, t_nameparts, t_roleterm, t_nameval WHERE t_name.name_id IN (%s)", lilid_to_string(&(ptr_namelists->name))); + sprintf(sql_command, "SELECT t_name.name_id FROM t_name, t_nameparts, t_roleterm, t_nameval WHERE t_name.name_id IN (%s)", lilid_to_string(&(ptr_namelists->name))); ptr_curr_lilid = &(ptr_namelists->roleterm); |