Changeset 17841 for trunk/psLib
- Timestamp:
- May 28, 2008, 4:43:04 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/db/psDB.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/db/psDB.c
r17838 r17841 23 23 * 4.1.2 or newer is required. 24 24 * 25 * $Id: psDB.c,v 1.15 4 2008-05-29 02:35:34 jhoblitt Exp $25 * $Id: psDB.c,v 1.155 2008-05-29 02:43:04 jhoblitt Exp $ 26 26 */ 27 27 … … 1641 1641 } 1642 1642 1643 1643 1644 // Reset iterator to head of list 1644 1645 psListIteratorSet(cursor, 0); 1645 1646 // look for INDEX values 1646 // look for UINDEXs before INDEXs 1647 1647 while ((item = psListGetAndIncrement(cursor))) { 1648 1648 // don't compile a regex unless we have too 1649 if (psStrcasestr(item->comment, " INDEX") == NULL) {1649 if (psStrcasestr(item->comment, "UINDEX") == NULL) { 1650 1650 continue; 1651 1651 } … … 1655 1655 int errbuf_size = 1024; 1656 1656 char errbuf[errbuf_size]; 1657 char *pattern = " INDEX[:space:]*[(]([^)]*)";1657 char *pattern = "UINDEX[:space:]*[(]([^)]*)"; 1658 1658 1659 1659 int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE); … … 1678 1678 regfree(&myregex); 1679 1679 1680 // sub string 1: index(.*)1680 // sub string 1: uindex(.*) 1681 1681 size_t matchStart = (size_t)mymatch[1].rm_so; 1682 1682 size_t matchEnd = (size_t)mymatch[1].rm_eo; … … 1692 1692 psString index = psStringNCopy(item->comment + matchStart, matchLength); 1693 1693 psTrace("psLib.db", 10, "regex $1 matched: %s", index); 1694 psStringAppend(&query, ", INDEX(%s)", index);1694 psStringAppend(&query, ", UNIQUE KEY(%s)", index); 1695 1695 psFree(index); 1696 1696 } … … 1698 1698 // Reset iterator to head of list 1699 1699 psListIteratorSet(cursor, 0); 1700 // look for UNIQUE INDEXES1700 // look for INDEX values 1701 1701 while ((item = psListGetAndIncrement(cursor))) { 1702 1702 // don't compile a regex unless we have too 1703 if (psStrcasestr(item->comment, " UINDEX") == NULL) {1703 if (psStrcasestr(item->comment, "INDEX") == NULL) { 1704 1704 continue; 1705 1705 } … … 1709 1709 int errbuf_size = 1024; 1710 1710 char errbuf[errbuf_size]; 1711 char *pattern = " UINDEX[:space:]*[(]([^)]*)";1711 char *pattern = "INDEX[:space:]*[(]([^)]*)"; 1712 1712 1713 1713 int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE); … … 1732 1732 regfree(&myregex); 1733 1733 1734 // sub string 1: uindex(.*)1734 // sub string 1: index(.*) 1735 1735 size_t matchStart = (size_t)mymatch[1].rm_so; 1736 1736 size_t matchEnd = (size_t)mymatch[1].rm_eo; … … 1746 1746 psString index = psStringNCopy(item->comment + matchStart, matchLength); 1747 1747 psTrace("psLib.db", 10, "regex $1 matched: %s", index); 1748 psStringAppend(&query, ", UNIQUE KEY(%s)", index);1748 psStringAppend(&query, ", INDEX(%s)", index); 1749 1749 psFree(index); 1750 1750 }
Note:
See TracChangeset
for help on using the changeset viewer.
