Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 3961)
+++ trunk/psLib/src/db/psDB.c	(revision 4043)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-05-18 23:19:46 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-05-28 01:01:32 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -356,4 +356,5 @@
     case PS_TYPE_BOOL:
         // valid for psVector?
+        PS_STR_ARRAY_TO_PTYPE(column->data.U8, stringColumn, atoi, psU8, PS_TYPE_U8);
         break;
     }
@@ -450,4 +451,6 @@
             } else if (pType == PS_META_F64) {
                 psMetadataAddF64(md, 0, field[i].name, "", atof(data));
+            } else if (pType == PS_META_BOOL) {
+                psMetadataAdd(md, 0, field[i].name, pType, "", atoi(data));
             } else {
                 // XXX: assume binary string ...
@@ -803,7 +806,12 @@
                               ? (my_bool *)&isNull
                               : NULL;
+        } else if (item->type == PS_TYPE_BOOL) {
+            bind[i].length  = 0;
+            bind[i].buffer  = &item->data.B;
+            bind[i].is_null = psDBIsPTypeNaN(item->type, &item->data.B)
+                              ? (my_bool *)&isNull
+                              : NULL;
+        } else if (item->type == PS_META_STR) {
             // convert NaNs to NULL and set the buffer_length for strings
-            //} else if ((item->type == PS_META_STR) && (item->pType == PS_TYPE_PTR)) {
-        } else if (item->type == PS_META_STR) {
 
             bind[i].buffer_length = (unsigned long)strlen((char *)item->data.V);
@@ -817,4 +825,5 @@
                     "FIXME: Only type of PS_TYPE_S32 (PS_META_S32), "
                     "PS_TYPE_F32 (PS_META_F32), PS_TYPE_F64 (PS_META_F64), "
+                    "PS_TYPE_BOOL (PS_META_BOOL), "
                     "and PS_META_STR are supported.");
 
@@ -856,6 +865,7 @@
     // find column name and type
     while ((item = psListGetAndIncrement(cursor))) {
-        if ((item->type == PS_META_S32) || (item->type == PS_META_F32) || (item->type == PS_META_F64) ||
-                (item->type == PS_TYPE_S32) || (item->type == PS_TYPE_F32) || (item->type == PS_TYPE_F64)) {
+        if ((item->type == PS_META_S32)  || (item->type == PS_META_F32) || (item->type == PS_META_F64) ||
+                (item->type == PS_TYPE_S32)  || (item->type == PS_TYPE_F32) || (item->type == PS_TYPE_F64) ||
+                (item->type == PS_TYPE_BOOL) || (item->type == PS_META_BOOL)) {
             // + column name + _ + column type
             colType = psDBPTypeToSQL(item->type);
@@ -867,5 +877,5 @@
         } else {
             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                    "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, "
+                    "FIXME: Only type of PS_META_S32, PS_META_F32, PS_META_F64, PS_META_BOOL, "
                     "and PS_META_STR are supported, (not %d).", item->type);
 
@@ -1072,4 +1082,6 @@
         } else if ((item->type == PS_META_F64) || (item->type == PS_TYPE_F64)) {
             psStringAppend(&query, "%s=%g", item->name, (double)(item->data.F64));
+        } else if ((item->type == PS_META_BOOL) || (item->type == PS_TYPE_BOOL)) {
+            psStringAppend(&query, "%s=%d", item->name, (int)(item->data.B));
         } else if (item->type == PS_META_STR) {
             // + column name + _ + like + _ + ' + value + '
@@ -1085,5 +1097,5 @@
         } else {
             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                    "Only types PS_META_S32, PS_META_F32, PS_META_F64, PS_META_STR is supported");
+                    "Only types PS_META_S32, PS_META_F32, PS_META_F64, PS_META_BOOL, PS_META_STR are supported");
 
             psFree(cursor);
@@ -1259,5 +1271,5 @@
         psDBAddToLookupTable(lookupTable, PS_TYPE_C32, "PS_TYPE_C32 is not supported");
         psDBAddToLookupTable(lookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported");
-        psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"BOOLEAN");
+        psDBAddToLookupTable(lookupTable, PS_TYPE_BOOL,"TINYINT");
         psDBAddToLookupTable(lookupTable, PS_META_STR, "VARCHAR");
     }
@@ -1522,5 +1534,6 @@
         break;
     case PS_TYPE_BOOL:
-        // what is NaN for a bool?
+        // XXX: what is NaN for a bool?
+        PS_NAN_ALLOC(myNaN, psU8, PS_MAX_U8);
         break;
     }
@@ -1575,5 +1588,6 @@
         break;
     case PS_TYPE_BOOL:
-        // what is NaN for a bool?
+        // XXX: what is NaN for a bool?
+        isNaN = PS_IS_NAN(psU8, data, PS_MAX_U8);
         break;
     }
