Index: trunk/Ohana/src/opihi/dvo/dbCheckStack.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/dbCheckStack.c	(revision 20818)
+++ trunk/Ohana/src/opihi/dvo/dbCheckStack.c	(revision 20936)
@@ -1,8 +1,14 @@
 # include "dvoshell.h"
+
+// XXX we are using a fairly bogus set of char values to distinguish a few cases:
+// 's', 'S' : value is a scalar (upper == float; lower == int)
+// 'f', 'F' : value is a field (upper == float; lower == int)
+// 't', 'T' : value is a temp scalar (upper == float; lower == int)
+// these would be better done using bit values to test for field? temp? float?
 
 int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *inNfields) {
 
   int i, j, status, NFIELDS, Nfields;
-  char *c;
+  char *c1, *c2;
   dbField *fields;
 
@@ -14,10 +20,16 @@
 
   for (i = 0; i < Nstack; i++) {
-    if (stack[i].type == 'X') {
+    if (stack[i].type == DB_STACK_VALUE) {
 
-      /** if this is a number, put it on the list of scalers and move on **/
-      stack[i].Float = strtod (stack[i].name, &c);
-      if (c == stack[i].name + strlen (stack[i].name)) {
-	stack[i].type  = 'S';
+      /** if this is a number, put it on the list of scalars and move on.  assume value is
+       * an int unless proven otherwise **/
+      stack[i].FltValue = strtod (stack[i].name, &c1);
+      stack[i].IntValue = strtol (stack[i].name, &c2, 0);
+      if (c2 == stack[i].name + strlen (stack[i].name)) {
+	stack[i].type  |= DB_STACK_INT;
+	continue;
+      } 
+      if (c1 == stack[i].name + strlen (stack[i].name)) {
+	// this is a float value
 	continue;
       } 
@@ -44,6 +56,6 @@
 	  code = GetPhotcodebyName (tmpstring);
 	  if (code) {
-	      stack[i].Float = code->code;
-	      stack[i].type  = 'S';
+	      stack[i].IntValue = code->code;
+	      stack[i].type = DB_STACK_INT;
 	      continue;
 	  } 
@@ -60,11 +72,16 @@
       if (j < Nfields) {
 	stack[i].field = j;
-	stack[i].type  = 'F';
+	stack[i].type |= DB_STACK_FIELD;
+	if (fields[j].type == OPIHI_INT) {
+	  stack[i].type |= DB_STACK_INT;
+	}
 	stack[i].name  = NULL;
-	stack[i].Float = 0.0;
+	stack[i].FltValue = 0.0;
+	stack[i].IntValue =   0;
 	continue;
       }
 
       // this must be a field : is it a valid name?
+      status = FALSE;
       if (table == DVO_TABLE_MEASURE) {
 	status = ParseMeasureField (&fields[Nfields], stack[i].name);
@@ -73,12 +90,18 @@
 	status = ParseAverageField (&fields[Nfields], stack[i].name);
       } 
+      if (table == DVO_TABLE_IMAGE) {
+	status = ParseImageField (&fields[Nfields], stack[i].name);
+      } 
       if (!status) {
-	gprint (GP_ERR, "unknown database field %s\n", stack[i].name);
 	goto failure;
       }
       stack[i].field = Nfields;
-      stack[i].type  = 'F';
+      stack[i].type |= DB_STACK_FIELD;
+      if (fields[Nfields].type == OPIHI_INT) {
+	stack[i].type |= DB_STACK_INT;
+      }
       stack[i].name  = NULL;
-      stack[i].Float = 0.0;
+      stack[i].FltValue = 0.0; // 'F'
+      stack[i].IntValue =   0; // 'f'
 
       Nfields ++;
