[Refdb-cvs] CVS: refdb/src refdbdbib.c,1.36,1.37
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-05-17 23:37:51
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1128 Modified Files: refdbdbib.c Log Message: minor quoting and free() fixes Index: refdbdbib.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdbib.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -U2 -r1.36 -r1.37 --- refdbdbib.c 15 Feb 2004 23:00:02 -0000 1.36 +++ refdbdbib.c 17 May 2004 23:37:42 -0000 1.37 @@ -1378,7 +1378,19 @@ while (dbi_result_next_row(dbires1)) { - item = my_dbi_result_get_string(dbires1, "author_abbrevlist"); + item = my_dbi_result_get_string_copy(dbires1, "author_abbrevlist"); n_pubyear = dbi_result_get_ushort(dbires1, "pubyear"); + /* quote item */ + if (dbi_driver_quote_string(dbi_conn_get_driver(ptr_bibconns->conn), (char**)&item) == -1) { + tiwrite(ptr_clrequest->fd, "", TERM_YES); + if (!assemble_return_msg(ptr_addresult, noformatupdatecolon.text, ptr_bibconns->conn)) { + LOG_PRINT(LOG_WARNING, ptr_addresult->msg); + } + free(sql_command); + free((char*)item); + return 1; + } + + /* increase buffer size if necessary */ if (strlen(item)+256 > sql_command_len) { @@ -1392,4 +1404,5 @@ dbi_result_free(dbires1); free(sql_command); + free((char*)item); return 1; } @@ -1399,6 +1412,9 @@ } - sprintf(sql_command, "SELECT DISTINCT entry_id,sorted_pos from %s WHERE author_abbrevlist='%s' AND pubyear=%d ORDER BY sorted_pos", table_name, item, n_pubyear); + sprintf(sql_command, "SELECT DISTINCT entry_id,sorted_pos from %s WHERE author_abbrevlist=%s AND pubyear=%d ORDER BY sorted_pos", table_name, item, n_pubyear); LOG_PRINT(LOG_DEBUG, sql_command); + + free((char*)item); + dbires2 = dbi_conn_query(ptr_bibconns->conn, sql_command); if (!dbires2) { |