src/hg/instinct/lib/raDb.c 1.2

1.2 2010/05/26 21:28:40 cszeto
Added microscope toggle support
Index: src/hg/instinct/lib/raDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/lib/raDb.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/instinct/lib/raDb.c	12 Apr 2010 17:16:10 -0000	1.1
+++ src/hg/instinct/lib/raDb.c	26 May 2010 21:28:40 -0000	1.2
@@ -48,40 +48,40 @@
     }
 ret->groupName = row[7];
 ret->raFile = row[8];
 ret->patDb = row[9];
-ret->sampleField = row[10];
-ret->patTable = row[11];
-ret->patField = row[12];
-ret->aliasTable = row[13];
-ret->displayNameTable = row[14];
-ret->dataType = row[15];
-ret->platform = row[16];
-if (row[17] != NULL)
+ret->microscope = row[10];
+ret->sampleField = row[11];
+ret->patTable = row[12];
+ret->patField = row[13];
+ret->aliasTable = row[14];
+ret->displayNameTable = row[15];
+ret->dataType = row[16];
+ret->platform = row[17];
+if (row[18] != NULL)
     {
     ret->expScale = needMem(sizeof(float));
-    *(ret->expScale) = sqlFloat(row[17]);
+    *(ret->expScale) = sqlFloat(row[18]);
     }
-if (row[18] != NULL)
+if (row[19] != NULL)
     {
     ret->gainFull = needMem(sizeof(float));
-    *(ret->gainFull) = sqlFloat(row[18]);
+    *(ret->gainFull) = sqlFloat(row[19]);
     }
-if (row[19] != NULL)
+if (row[20] != NULL)
     {
     ret->gainSet = needMem(sizeof(float));
-    *(ret->gainSet) = sqlFloat(row[19]);
+    *(ret->gainSet) = sqlFloat(row[20]);
     }
-ret->type = row[20];
-ret->visibility = row[21];
-if (row[22] != NULL)
+ret->type = row[21];
+ret->visibility = row[22];
+if (row[23] != NULL)
     {
     ret->priority = needMem(sizeof(float));
-    *(ret->priority) = sqlFloat(row[22]);
+    *(ret->priority) = sqlFloat(row[23]);
     }
-ret->url = row[23];
-ret->security = row[24];
-ret->local_url = row[25];
+ret->url = row[24];
+ret->security = row[25];
 ret->profile = row[26];
 ret->wrangler = row[27];
 ret->citation = row[28];
 ret->article_title = row[29];
@@ -120,10 +120,10 @@
  * For example "autosql's features include" --> "autosql\'s features include" 
  * If worried about this use raDbSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
-dyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s',%u,%u,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,%g,%g,'%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
-	tableName,  *(el->id),  el->name,  el->accessTable,  el->shortLabel,  el->longLabel,  *(el->expCount),  *(el->height),  el->groupName,  el->raFile,  el->patDb,  el->sampleField,  el->patTable,  el->patField,  el->aliasTable,  el->displayNameTable,  el->dataType,  el->platform,  *(el->expScale),  *(el->gainFull),  *(el->gainSet),  el->type,  el->visibility,  *(el->priority),  el->url,  el->security,  el->local_url,  el->profile,  el->wrangler,  el->citation, (el->article_title), (el->author_list),  (el->wrangling_procedure));
+dyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s',%u,%u,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,%g,%g,'%s','%s',%g,'%s','%s','%s','%s','%s',%s,%s,%s)", 
+	tableName,  *(el->id),  el->name,  el->accessTable,  el->shortLabel,  el->longLabel,  *(el->expCount),  *(el->height),  el->groupName,  el->raFile,  el->patDb,  el->microscope,  el->sampleField,  el->patTable,  el->patField,  el->aliasTable,  el->displayNameTable,  el->dataType,  el->platform,  *(el->expScale),  *(el->gainFull),  *(el->gainSet),  el->type,  el->visibility,  *(el->priority),  el->url,  el->security,  el->profile,  el->wrangler,  el->citation,  (el->article_title),  (el->author_list),  (el->wrangling_procedure));
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
@@ -136,16 +136,17 @@
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
-char  *name, *accessTable, *shortLabel, *longLabel, *groupName, *raFile, *patDb, *sampleField, *patTable, *patField, *aliasTable, *displayNameTable, *dataType, *platform, *type, *visibility, *url, *security, *local_url, *profile, *wrangler, *citation, *article_title, *author_list, *wrangling_procedure;
+char  *name, *accessTable, *shortLabel, *longLabel, *groupName, *raFile, *patDb, *microscope, *sampleField, *patTable, *patField, *aliasTable, *displayNameTable, *dataType, *platform, *type, *visibility, *url, *security, *profile, *wrangler, *citation, *article_title, *author_list, *wrangling_procedure;
 name = sqlEscapeString(el->name);
 accessTable = sqlEscapeString(el->accessTable);
 shortLabel = sqlEscapeString(el->shortLabel);
 longLabel = sqlEscapeString(el->longLabel);
 groupName = sqlEscapeString(el->groupName);
 raFile = sqlEscapeString(el->raFile);
 patDb = sqlEscapeString(el->patDb);
+microscope = sqlEscapeString(el->microscope);
 sampleField = sqlEscapeString(el->sampleField);
 patTable = sqlEscapeString(el->patTable);
 patField = sqlEscapeString(el->patField);
 aliasTable = sqlEscapeString(el->aliasTable);
@@ -155,18 +156,17 @@
 type = sqlEscapeString(el->type);
 visibility = sqlEscapeString(el->visibility);
 url = sqlEscapeString(el->url);
 security = sqlEscapeString(el->security);
-local_url = sqlEscapeString(el->local_url);
 profile = sqlEscapeString(el->profile);
 wrangler = sqlEscapeString(el->wrangler);
 citation = sqlEscapeString(el->citation);
 article_title = sqlEscapeString(el->article_title);
 author_list = sqlEscapeString(el->author_list);
 wrangling_procedure = sqlEscapeString(el->wrangling_procedure);
 
-dyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s',%u,%u,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,%g,%g,'%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
-	tableName,  *(el->id),  name,  accessTable,  shortLabel,  longLabel,  *(el->expCount),  *(el->height),  groupName,  raFile,  patDb,  sampleField,  patTable,  patField,  aliasTable,  displayNameTable,  dataType,  platform,  *(el->expScale),  *(el->gainFull),  *(el->gainSet),  type,  visibility,  *(el->priority),  url,  security,  local_url,  profile,  wrangler,  citation,  article_title,  author_list,  wrangling_procedure);
+dyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s',%u,%u,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,%g,%g,'%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s')", 
+	tableName,  *(el->id),  name,  accessTable,  shortLabel,  longLabel,  *(el->expCount),  *(el->height),  groupName,  raFile,  patDb,  microscope,  sampleField,  patTable,  patField,  aliasTable,  displayNameTable,  dataType,  platform,  *(el->expScale),  *(el->gainFull),  *(el->gainSet),  type,  visibility,  *(el->priority),  url,  security,  profile,  wrangler,  citation,  article_title,  author_list,  wrangling_procedure);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&name);
 freez(&accessTable);
@@ -174,8 +174,9 @@
 freez(&longLabel);
 freez(&groupName);
 freez(&raFile);
 freez(&patDb);
+freez(&microscope);
 freez(&sampleField);
 freez(&patTable);
 freez(&patField);
 freez(&aliasTable);
@@ -185,9 +186,8 @@
 freez(&type);
 freez(&visibility);
 freez(&url);
 freez(&security);
-freez(&local_url);
 freez(&profile);
 freez(&wrangler);
 freez(&citation);
 freez(&article_title);
@@ -235,40 +235,40 @@
     }
 ret->groupName = cloneString(row[7]);
 ret->raFile = cloneString(row[8]);
 ret->patDb = cloneString(row[9]);
-ret->sampleField = cloneString(row[10]);
-ret->patTable = cloneString(row[11]);
-ret->patField = cloneString(row[12]);
-ret->aliasTable = cloneString(row[13]);
-ret->displayNameTable = cloneString(row[14]);
-ret->dataType = cloneString(row[15]);
-ret->platform = cloneString(row[16]);
-if (row[17] != NULL)
+ret->microscope = cloneString(row[10]);
+ret->sampleField = cloneString(row[11]);
+ret->patTable = cloneString(row[12]);
+ret->patField = cloneString(row[13]);
+ret->aliasTable = cloneString(row[14]);
+ret->displayNameTable = cloneString(row[15]);
+ret->dataType = cloneString(row[16]);
+ret->platform = cloneString(row[17]);
+if (row[18] != NULL)
     {
     ret->expScale = needMem(sizeof(float));
-    *(ret->expScale) = sqlFloat(row[17]);
+    *(ret->expScale) = sqlFloat(row[18]);
     }
-if (row[18] != NULL)
+if (row[19] != NULL)
     {
     ret->gainFull = needMem(sizeof(float));
-    *(ret->gainFull) = sqlFloat(row[18]);
+    *(ret->gainFull) = sqlFloat(row[19]);
     }
-if (row[19] != NULL)
+if (row[20] != NULL)
     {
     ret->gainSet = needMem(sizeof(float));
-    *(ret->gainSet) = sqlFloat(row[19]);
+    *(ret->gainSet) = sqlFloat(row[20]);
     }
-ret->type = cloneString(row[20]);
-ret->visibility = cloneString(row[21]);
-if (row[22] != NULL)
+ret->type = cloneString(row[21]);
+ret->visibility = cloneString(row[22]);
+if (row[23] != NULL)
     {
     ret->priority = needMem(sizeof(float));
-    *(ret->priority) = sqlFloat(row[22]);
+    *(ret->priority) = sqlFloat(row[23]);
     }
-ret->url = cloneString(row[23]);
-ret->security = cloneString(row[24]);
-ret->local_url = cloneString(row[25]);
+ret->url = cloneString(row[24]);
+ret->security = cloneString(row[25]);
 ret->profile = cloneString(row[26]);
 ret->wrangler = cloneString(row[27]);
 ret->citation = cloneString(row[28]);
 ret->article_title = cloneString(row[29]);
@@ -334,8 +334,9 @@
 *(ret->height) = sqlUnsignedComma(&s);
 ret->groupName = sqlStringComma(&s);
 ret->raFile = sqlStringComma(&s);
 ret->patDb = sqlStringComma(&s);
+ret->microscope = sqlStringComma(&s);
 ret->sampleField = sqlStringComma(&s);
 ret->patTable = sqlStringComma(&s);
 ret->patField = sqlStringComma(&s);
 ret->aliasTable = sqlStringComma(&s);
@@ -353,9 +354,8 @@
 ret->priority = needMem(sizeof(*(ret->priority)));
 *(ret->priority) = sqlFloatComma(&s);
 ret->url = sqlStringComma(&s);
 ret->security = sqlStringComma(&s);
-ret->local_url = sqlStringComma(&s);
 ret->profile = sqlStringComma(&s);
 ret->wrangler = sqlStringComma(&s);
 ret->citation = sqlStringComma(&s);
 ret->article_title = sqlStringComma(&s);
@@ -378,8 +378,9 @@
 freeMem(el->longLabel);
 freeMem(el->groupName);
 freeMem(el->raFile);
 freeMem(el->patDb);
+freeMem(el->microscope);
 freeMem(el->sampleField);
 freeMem(el->patTable);
 freeMem(el->patField);
 freeMem(el->aliasTable);
@@ -389,9 +390,8 @@
 freeMem(el->type);
 freeMem(el->visibility);
 freeMem(el->url);
 freeMem(el->security);
-freeMem(el->local_url);
 freeMem(el->profile);
 freeMem(el->wrangler);
 freeMem(el->citation);
 freeMem(el->article_title);
@@ -450,8 +450,12 @@
 fprintf(f, "%s", el->patDb);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->microscope);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleField);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
@@ -502,12 +506,8 @@
 fprintf(f, "%s", el->security);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->local_url);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->profile);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
@@ -610,8 +610,16 @@
 fprintf(f, "%s", el->patDb);
 fputc('"',f);
 fputc(',',f);
 fputc('"',f);
+fprintf(f,"microscope");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->microscope);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
 fprintf(f,"sampleField");
 fputc('"',f);
 fputc(':',f);
 fputc('"',f);
@@ -722,16 +730,8 @@
 fprintf(f, "%s", el->security);
 fputc('"',f);
 fputc(',',f);
 fputc('"',f);
-fprintf(f,"local_url");
-fputc('"',f);
-fputc(':',f);
-fputc('"',f);
-fprintf(f, "%s", el->local_url);
-fputc('"',f);
-fputc(',',f);
-fputc('"',f);
 fprintf(f,"profile");
 fputc('"',f);
 fputc(':',f);
 fputc('"',f);