IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 5, 2007, 6:38:29 PM (19 years ago)
Author:
jhoblitt
Message:

add "NOT NULL" field attribute support to psDBGenerateCreateTable()
convert from strstr() -> strcasestr() where appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/db/psDB.c

    r10737 r10951  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.123 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-12-14 23:03:40 $
     14 *  @version $Revision: 1.124 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2007-01-06 04:38:29 $
    1616 *
    1717 *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
    1818 */
     19
     20#ifdef HAVE_CONFIG_H
     21#include <config.h>
     22#endif
    1923
    2024#ifdef HAVE_PSDB
     
    15071511        }
    15081512
    1509         if (strstr(item->comment, "AUTO_INCREMENT")) {
     1513        if (strcasestr(item->comment, "AUTO_INCREMENT")) {
    15101514            psStringAppend(&query, " %s", "AUTO_INCREMENT");
    15111515        }
    1512         if (strstr(item->comment, "Unique")) {
     1516        if (strcasestr(item->comment, "Unique")) {
    15131517            psStringAppend(&query, " %s", "UNIQUE");
     1518        }
     1519        if (strcasestr(item->comment, "NOT NULL")) {
     1520            psStringAppend(&query, " %s", "NOT NULL");
    15141521        }
    15151522
     
    15281535    psArray *pKeys = psArrayAllocEmpty(1);
    15291536    while ((item = psListGetAndIncrement(cursor))) {
    1530         if (strstr(item->comment, "Primary Key")) {
     1537        if (strcasestr(item->comment, "Primary Key")) {
    15311538            psArrayAdd(pKeys, 0, item->name);
    15321539        }
     
    15501557    while ((item = psListGetAndIncrement(cursor))) {
    15511558        // it's just a regular key if it matchs "Key" but not "Primary Key"
    1552         if (strstr(item->comment, "Key")
    1553                 && (strstr(item->comment, "Primary Key") == NULL)) {
     1559        if (strcasestr(item->comment, "Key")
     1560                && (strcasestr(item->comment, "Primary Key") == NULL)) {
    15541561            psStringAppend(&query, ", KEY(%s)", item->name);
    1555         } else if (strstr(item->comment, "AUTO_INCREMENT")) {
     1562        } else if (strcasestr(item->comment, "AUTO_INCREMENT")) {
    15561563            // this needs to be recognized as a key if it wasn't already
    15571564            psStringAppend(&query, ", KEY(%s)", item->name);
     
    17751782            psMetadataItem *mItem = NULL;
    17761783            while ((mItem = psListGetAndIncrement(mCursor))) {
    1777                 if (mItem->comment && strstr(mItem->comment, "==")) {
     1784                if (mItem->comment && strcasestr(mItem->comment, "==")) {
    17781785                    logicalOp = "OR";
    17791786                    break;
     
    19841991            psStringAppend(&query, "%s IS NULL", itemName);
    19851992        } else {
    1986             if (item->comment && strstr(item->comment, "LIKE")) {
     1993            if (item->comment && strcasestr(item->comment, "LIKE")) {
    19871994                // XXX ASC NOTE: we should have a better match for
    19881995                // char & varchar columns than this.  LIKE is OK for
Note: See TracChangeset for help on using the changeset viewer.