src/hg/instinct/bioInt2/bioIntDb.c 1.6
1.6 2009/04/01 03:26:58 jsanborn
fixed db code
Index: src/hg/instinct/bioInt2/bioIntDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntDb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -B -U 4 -r1.5 -r1.6
--- src/hg/instinct/bioInt2/bioIntDb.c 29 Mar 2009 01:40:42 -0000 1.5
+++ src/hg/instinct/bioInt2/bioIntDb.c 1 Apr 2009 03:26:58 -0000 1.6
@@ -9,8 +9,31 @@
#include "bioIntDb.h"
static char const rcsid[] = "$Id$";
+void sqlFloatDynamicArrayFixedSize(char *s, float **retArray, int size)
+/* Convert comma separated list of numbers to an dynamically allocated
+ * array, which should be freeMem()'d when done. */
+{
+float *array = NULL;
+unsigned count = 0;
+
+AllocArray(array, size);
+for (;;)
+ {
+ char *e;
+ if (s == NULL || s[0] == 0 || count == size)
+ break;
+ e = strchr(s, ',');
+ if (e != NULL)
+ *e++ = 0;
+
+ array[count++] = atof(s);
+ s = e;
+ }
+*retArray = array;
+}
+
void pathwaysStaticLoad(char **row, struct pathways *ret)
/* Load a row from pathways table into ret. The contents of ret will
* be replaced at the next call to this function. */
{
@@ -2061,11 +2084,12 @@
AllocVar(ret);
ret->sample_count = sqlUnsigned(row[1]);
ret->probe_id = sqlUnsigned(row[0]);
{
-int sizeOne;
-sqlFloatDynamicArray(row[2], &ret->sample_data, &sizeOne);
-assert(sizeOne == ret->sample_count);
+sqlFloatDynamicArrayFixedSize(row[2], &ret->sample_data, ret->sample_count);
+//int sizeOne;
+//sqlFloatDynamicArray(row[2], &ret->sample_data, &sizeOne);
+//assert(sizeOne == ret->sample_count);
}
return ret;
}