[Refdb-cvs] CVS: refdb/src backend-dbib.c,1.28.2.2,1.28.2.3
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-08-21 15:42:19
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5482 Modified Files: Tag: Release_0_9_5_stable backend-dbib.c Log Message: various fixes to get sorting order, subsequent status, and year suffix right in multiple citation strings Index: backend-dbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend-dbib.c,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -u -U2 -r1.28.2.2 -r1.28.2.3 --- backend-dbib.c 11 Aug 2004 20:59:15 -0000 1.28.2.2 +++ backend-dbib.c 21 Aug 2004 15:42:05 -0000 1.28.2.3 @@ -220,4 +220,5 @@ const char *item_entry_id; const char *drivername; + const char *author_concat; char *item_preceeding; char *item_following; @@ -233,4 +234,7 @@ int n_consec; int n_multiple_db = 0; /* if 1, conn allows multiple databases */ + int n_is_subseq = 0; + int n_currpos; + short int n_pubyear; unsigned long long n_sorted_pos1; unsigned long long n_citation_pos; @@ -408,14 +412,14 @@ /* request all xrefs of this citation and sort them according to the required format */ if (strcmp(item_intextseq, "ASIS") == 0) { - sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos FROM %s WHERE citation_pos="ULLSPEC" ORDER BY xref_pos", table_name, (unsigned long long)n_citation_pos); + sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos, year_uni_suffix FROM %s WHERE citation_pos="ULLSPEC" ORDER BY xref_pos", table_name, (unsigned long long)n_citation_pos); } else if (strcmp(item_intextseq, "AUTHORDATE") == 0) { - sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos FROM %s WHERE citation_pos="ULLSPEC" ORDER BY author_concat, pubyear, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); + sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos, year_uni_suffix FROM %s WHERE citation_pos="ULLSPEC" ORDER BY author_concat, pubyear, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); } else if (strcmp(item_intextseq, "DATEASC") == 0) { - sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos FROM %s WHERE citation_pos="ULLSPEC" ORDER BY pubyear, author_concat, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); + sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos, year_uni_suffix FROM %s WHERE citation_pos="ULLSPEC" ORDER BY pubyear, author_concat, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); } else if (strcmp(item_intextseq, "DATEDESC") == 0) { - sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos FROM %s WHERE citation_pos="ULLSPEC" ORDER BY pubyear DESC, author_concat, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); + sprintf(sql_command, "SELECT DISTINCT dbname, orig_id, author_concat, pubyear, article_title, periodical, volume, issue, startpage, entry_id, citation_pos, xref_pos, multi_id, sorted_pos, year_uni_suffix FROM %s WHERE citation_pos="ULLSPEC" ORDER BY pubyear DESC, author_concat, periodical, volume, issue, startpage", table_name, (unsigned long long)n_citation_pos); } @@ -483,4 +487,7 @@ } + ptr_biblio_info->year_unique_suffix = dbi_result_get_string(dbires2, "year_uni_suffix"); + + /* start with the code that appears in front of all xrefs */ if (nis_first) { @@ -645,4 +652,27 @@ /* item_entry_id checked for non-NULL above */ ptr_biblio_info->entry_id = item_entry_id; + ptr_biblio_info->n_refdb_id = my_dbi_result_get_idval(dbires3, "n_refdb_id"); + + + author_concat = dbi_result_get_string(dbires2, "author_concat"); + n_currpos = dbi_result_get_long(dbires2, "sorted_pos"); + n_pubyear = dbi_result_get_short(dbires2, "pubyear"); + + n_is_subseq = check_is_subseq(author_concat, table_name, n_currpos, n_pubyear, ptr_bibconns->conn); + + if (n_is_subseq == -1) { + LOG_PRINT(LOG_WARNING, "could not retrieve query results"); + delete_all_lilimem(&sentinel); + dbi_result_free(dbires); + dbi_result_free(dbires1); + dbi_result_free(dbires2); + dbi_result_free(dbires3); + return NULL; + } + + ptr_biblio_info->is_subseq = n_is_subseq; + + + |