Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8501
Modified Files:
xmlhandler.c
Log Message:
quote author names properly
Index: xmlhandler.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/xmlhandler.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -U2 -r1.21 -r1.22
--- xmlhandler.c 3 Jan 2004 20:11:44 -0000 1.21
+++ xmlhandler.c 28 Apr 2004 03:03:16 -0000 1.22
@@ -1430,4 +1430,8 @@
else {
if (id_string != NULL) {
+ dbi_driver driver;
+
+ driver = dbi_conn_get_driver(ptr_gbdata->conn);
+
/* select items and stash them into the temporary table */
/* all fields that we can get directly from t_refdb */
@@ -1472,7 +1476,4 @@
char *my_refdb_issue;
char *my_refdb_startpage;
- dbi_driver driver;
-
- driver = dbi_conn_get_driver(ptr_gbdata->conn);
my_refdb_title = my_dbi_result_get_string_copy(dbires, "refdb_title");
@@ -1544,12 +1545,29 @@
else {
while ((query_result = get_author(dbires1)) != NULL) {
- if ((new_sql_command = mstrcat(sql_command, (char*)query_result, &sql_command_len, 0)) == NULL) {
+ char *author_q;
+
+ author_q = strdup(query_result);
+ if (!author_q || dbi_driver_quote_string(driver, &author_q) == -1) {
+ LOG_PRINT(LOG_WARNING, "out of memory");
(*(ptr_gbdata->ptr_nmem_error))++;
- break;
}
- else {
- sql_command = new_sql_command;
+ else if (*author_q) {
+ /* the quoted author is enclosed in quotes (who
+ would have thought?) but we don't need these
+ here; we need only the internal quotes */
+ author_q[strlen(author_q)-1] = '\0';
+
+ if ((new_sql_command = mstrcat(sql_command, author_q + 1, &sql_command_len, 0)) == NULL) {
+ (*(ptr_gbdata->ptr_nmem_error))++;
+ break;
+ }
+ else {
+ sql_command = new_sql_command;
+ }
+
+ free(author_q);
}
}
+
if ((new_sql_command = mstrcat(sql_command, "\' WHERE id=", &sql_command_len, 0)) == NULL) {
(*(ptr_gbdata->ptr_nmem_error))++;
|