IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17841 for trunk/psLib


Ignore:
Timestamp:
May 28, 2008, 4:43:04 PM (18 years ago)
Author:
jhoblitt
Message:

check for uindex before index

File:
1 edited

Legend:

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

    r17838 r17841  
    2323 * 4.1.2 or newer is required.
    2424 *
    25  * $Id: psDB.c,v 1.154 2008-05-29 02:35:34 jhoblitt Exp $
     25 * $Id: psDB.c,v 1.155 2008-05-29 02:43:04 jhoblitt Exp $
    2626 */
    2727
     
    16411641    }
    16421642
     1643
    16431644    // Reset iterator to head of list
    16441645    psListIteratorSet(cursor, 0);
    1645 
    1646     // look for INDEX values
     1646    // look for UINDEXs before INDEXs
    16471647    while ((item = psListGetAndIncrement(cursor))) {
    16481648        // don't compile a regex unless we have too
    1649         if (psStrcasestr(item->comment, "INDEX") == NULL) {
     1649        if (psStrcasestr(item->comment, "UINDEX") == NULL) {
    16501650            continue;
    16511651        }
     
    16551655        int             errbuf_size = 1024;
    16561656        char            errbuf[errbuf_size];
    1657         char            *pattern = "INDEX[:space:]*[(]([^)]*)";
     1657        char            *pattern = "UINDEX[:space:]*[(]([^)]*)";
    16581658
    16591659        int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE);
     
    16781678        regfree(&myregex);
    16791679
    1680         // sub string 1: index(.*)
     1680        // sub string 1: uindex(.*)
    16811681        size_t matchStart = (size_t)mymatch[1].rm_so;
    16821682        size_t matchEnd   = (size_t)mymatch[1].rm_eo;
     
    16921692        psString index = psStringNCopy(item->comment + matchStart, matchLength);
    16931693        psTrace("psLib.db", 10, "regex $1 matched: %s", index);
    1694         psStringAppend(&query, ", INDEX(%s)", index);
     1694        psStringAppend(&query, ", UNIQUE KEY(%s)", index);
    16951695        psFree(index);
    16961696    }
     
    16981698    // Reset iterator to head of list
    16991699    psListIteratorSet(cursor, 0);
    1700     // look for UNIQUE INDEXES
     1700    // look for INDEX values
    17011701    while ((item = psListGetAndIncrement(cursor))) {
    17021702        // don't compile a regex unless we have too
    1703         if (psStrcasestr(item->comment, "UINDEX") == NULL) {
     1703        if (psStrcasestr(item->comment, "INDEX") == NULL) {
    17041704            continue;
    17051705        }
     
    17091709        int             errbuf_size = 1024;
    17101710        char            errbuf[errbuf_size];
    1711         char            *pattern = "UINDEX[:space:]*[(]([^)]*)";
     1711        char            *pattern = "INDEX[:space:]*[(]([^)]*)";
    17121712
    17131713        int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE);
     
    17321732        regfree(&myregex);
    17331733
    1734         // sub string 1: uindex(.*)
     1734        // sub string 1: index(.*)
    17351735        size_t matchStart = (size_t)mymatch[1].rm_so;
    17361736        size_t matchEnd   = (size_t)mymatch[1].rm_eo;
     
    17461746        psString index = psStringNCopy(item->comment + matchStart, matchLength);
    17471747        psTrace("psLib.db", 10, "regex $1 matched: %s", index);
    1748         psStringAppend(&query, ", UNIQUE KEY(%s)", index);
     1748        psStringAppend(&query, ", INDEX(%s)", index);
    17491749        psFree(index);
    17501750    }
Note: See TracChangeset for help on using the changeset viewer.