Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 10950)
+++ /trunk/psLib/src/db/psDB.c	(revision 10951)
@@ -12,9 +12,13 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.123 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-12-14 23:03:40 $
+ *  @version $Revision: 1.124 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-01-06 04:38:29 $
  *
  *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
  */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef HAVE_PSDB
@@ -1507,9 +1511,12 @@
         }
 
-        if (strstr(item->comment, "AUTO_INCREMENT")) {
+        if (strcasestr(item->comment, "AUTO_INCREMENT")) {
             psStringAppend(&query, " %s", "AUTO_INCREMENT");
         }
-        if (strstr(item->comment, "Unique")) {
+        if (strcasestr(item->comment, "Unique")) {
             psStringAppend(&query, " %s", "UNIQUE");
+        }
+        if (strcasestr(item->comment, "NOT NULL")) {
+            psStringAppend(&query, " %s", "NOT NULL");
         }
 
@@ -1528,5 +1535,5 @@
     psArray *pKeys = psArrayAllocEmpty(1);
     while ((item = psListGetAndIncrement(cursor))) {
-        if (strstr(item->comment, "Primary Key")) {
+        if (strcasestr(item->comment, "Primary Key")) {
             psArrayAdd(pKeys, 0, item->name);
         }
@@ -1550,8 +1557,8 @@
     while ((item = psListGetAndIncrement(cursor))) {
         // it's just a regular key if it matchs "Key" but not "Primary Key"
-        if (strstr(item->comment, "Key")
-                && (strstr(item->comment, "Primary Key") == NULL)) {
+        if (strcasestr(item->comment, "Key")
+                && (strcasestr(item->comment, "Primary Key") == NULL)) {
             psStringAppend(&query, ", KEY(%s)", item->name);
-        } else if (strstr(item->comment, "AUTO_INCREMENT")) {
+        } else if (strcasestr(item->comment, "AUTO_INCREMENT")) {
             // this needs to be recognized as a key if it wasn't already
             psStringAppend(&query, ", KEY(%s)", item->name);
@@ -1775,5 +1782,5 @@
             psMetadataItem *mItem = NULL;
             while ((mItem = psListGetAndIncrement(mCursor))) {
-                if (mItem->comment && strstr(mItem->comment, "==")) {
+                if (mItem->comment && strcasestr(mItem->comment, "==")) {
                     logicalOp = "OR";
                     break;
@@ -1984,5 +1991,5 @@
             psStringAppend(&query, "%s IS NULL", itemName);
         } else {
-            if (item->comment && strstr(item->comment, "LIKE")) {
+            if (item->comment && strcasestr(item->comment, "LIKE")) {
                 // XXX ASC NOTE: we should have a better match for
                 // char & varchar columns than this.  LIKE is OK for
