src/hg/makeDb/hgLoadBed/hgLoadBed.c 1.69

1.69 2009/04/24 22:14:48 larrym
fix mysql 'Commands out of sync' problem
Index: src/hg/makeDb/hgLoadBed/hgLoadBed.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/makeDb/hgLoadBed/hgLoadBed.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -b -B -U 4 -r1.68 -r1.69
--- src/hg/makeDb/hgLoadBed/hgLoadBed.c	14 Apr 2009 04:03:29 -0000	1.68
+++ src/hg/makeDb/hgLoadBed/hgLoadBed.c	24 Apr 2009 22:14:48 -0000	1.69
@@ -490,8 +490,9 @@
 			if ( !(max == -1 && min == -1)) // if score is -1 then ignore, as if it werent present
 			    {
 			    if (max == min || sameString(row[0],row[1])) // this will lead to 'inf' score value in SQL update causing an error
 				errAbort("Could not set score in table %s max(%s)=min(%s)=%s\n", track, fillInScoreColumn, fillInScoreColumn, row[0]);
+                            sqlFreeResult(&sr);
 
 			    // Calculate a, b s/t f(x) = ax + b maps min-max => minScore-1000
 			    float a = (1000-minScore) / (max - min);
 			    float b = 1000 - ((1000-minScore) * max) / (max - min);
@@ -501,12 +502,12 @@
 			    verbose(2, "update query: %s; changed: %d\n", query, changed);
 			    }
 			else
 			    {
+                            sqlFreeResult(&sr);
 			    verbose(2, "score not updated; all values for column %s are -1\n", fillInScoreColumn);
 			    }
 			}
-                    sqlFreeResult(&sr);
                     }
                 }
             }