9316d91190e7ab2edcf839bf465d2439670bb400 hiram Thu Nov 21 14:34:40 2013 -0800 make sure numChanged and numMatched are initialzed properly before use refs #12209 diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c index 9f3e8c0..0a891b1 100644 --- src/hg/lib/jksql.c +++ src/hg/lib/jksql.c @@ -1274,31 +1274,32 @@ } void sqlUpdate(struct sqlConnection *conn, char *query) /* Tell database to do something that produces no results table. */ { struct sqlResult *sr; sr = sqlGetResult(conn,query); sqlFreeResult(&sr); } int sqlUpdateRows(struct sqlConnection *conn, char *query, int* matched) /* Execute an update query, returning the number of rows change. If matched * is not NULL, it gets the total number matching the query. */ { -int numChanged, numMatched; +int numChanged = 0; +int numMatched = 0; const char *info; int numScan = 0; struct sqlResult *sr = sqlGetResult(conn,query); /* Rows matched: 40 Changed: 40 Warnings: 0 */ monitorEnter(); info = mysql_info(conn->conn); monitorLeave(); if (info != NULL) numScan = sscanf(info, "Rows matched: %d Changed: %d Warnings: %*d", &numMatched, &numChanged); if ((info == NULL) || (numScan < 2)) errAbort("can't get info (maybe not an sql UPDATE): %s", query); sqlFreeResult(&sr); if (matched != NULL)