Changeset 3848 for trunk/tools/database
- Timestamp:
- Jul 18, 2000, 7:56:51 PM (25 years ago)
- Location:
- trunk/tools/database
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/Authors.sql
r3838 r3848 1 -- $Id: Authors.sql,v 1. 3 2000-07-18 07:15:56bird Exp $1 -- $Id: Authors.sql,v 1.4 2000-07-18 17:56:49 bird Exp $ 2 2 -- 3 3 -- Insert authors. … … 9 9 DELETE FROM author; 10 10 -- refcode name initials alias email country city/location 11 -- (cvs user) 11 12 INSERT INTO author VALUES ( 1, 'Sander van Leeuwen', 'SvL', 'sandervl', 'sandervl@xs4all.nl', 'the Netherlands', 'Delft'); 12 13 INSERT INTO author VALUES ( 2, 'Peter Fitzsimmons', 'PF', NULL, 'pfitzsim@home.com', 'Canada', 'Mississauga, Ontario'); 13 INSERT INTO author VALUES ( 3, 'Patrick Haller', 'PT', 'phaller', ' haller@zebra.fh-weingarten.de','Germany', NULL);14 INSERT INTO author VALUES ( 4, 'Joel Troster', 'JT', NULL,'jtroster@atitech.ca', 'Canada', 'Thornhill, Ontario');15 INSERT INTO author VALUES ( 5, 'Vince Vielhaber', 'VV', NULL,'vev@michvhf.com', 'USA', 'Oxford, MI');14 INSERT INTO author VALUES ( 3, 'Patrick Haller', 'PT', 'phaller', 'phaller@gmx.net', 'Germany', NULL); 15 INSERT INTO author VALUES ( 4, 'Joel Troster', 'JT', 'jtroster', 'jtroster@atitech.ca', 'Canada', 'Thornhill, Ontario'); 16 INSERT INTO author VALUES ( 5, 'Vince Vielhaber', 'VV', 'vince', 'vev@michvhf.com', 'USA', 'Oxford, MI'); 16 17 INSERT INTO author VALUES ( 6, 'Chris McKillop', 'CMK', NULL, 'cdmckill@engmail.uwaterloo.ca', 'Canada', 'Waterloo, Ontario'); 17 18 INSERT INTO author VALUES ( 7, 'Felix Maschek', 'FM', NULL, 'felix@maschek.com', 'Germany', 'Ammersbek'); … … 19 20 INSERT INTO author VALUES ( 8, 'Mark Stead', 'MS', NULL, 'mar-@unico.com.au', NULL, NULL); 20 21 INSERT INTO author VALUES ( 9, 'Henk Kelder', 'HK', NULL, 'henk.kelde-@capgemini.nl', NULL, NULL); 21 INSERT INTO author VALUES (10, 'Daniela Engert', 'DE', NULL, 'd.enger-@odn.de',NULL, NULL);22 INSERT INTO author VALUES (10, 'Daniela Engert', 'DE', 'dengert', 'dani@ngrt.de', NULL, NULL); 22 23 INSERT INTO author VALUES (11, 'Jens Bckman', 'JB', NULL, 'os2war-@hem.passagen.se', NULL, NULL); 23 24 INSERT INTO author VALUES (12, 'Ed Ng', 'EG', NULL, 'en-@hubcap.clemson.edu', NULL, NULL); 24 25 INSERT INTO author VALUES (13, 'Ken Ames', 'KA', NULL, 'kename-@eathlink.net', NULL, NULL); 25 26 INSERT INTO author VALUES (14, 'Craig Bradney', 'CrB', NULL, 'cbradne-@zip.com.au', NULL, NULL); 26 INSERT INTO author VALUES (15, 'Achim Hasenmueller', 'AH', NULL, 'achimh-@innotek.de', NULL, NULL);27 INSERT INTO author VALUES (15, 'Achim Hasenmueller', 'AH', 'achimha', 'achimha@innotek.de', NULL, NULL); 27 28 INSERT INTO author VALUES (16, 'Rene Pronk', 'RPr', NULL, 'r.pron-@twi.tudelft.nl', NULL, NULL); 28 INSERT INTO author VALUES (17, 'Christoph Bratschi', 'ChB', NULL,'cbratsch-@datacomm.ch', NULL, NULL);29 INSERT INTO author VALUES (18, 'Przemyslaw Dobrowolski','PD', NULL, 'dobrawk -@asua.org.pl', NULL, NULL);29 INSERT INTO author VALUES (17, 'Christoph Bratschi', 'ChB', 'cbratschi','cbratsch-@datacomm.ch', NULL, NULL); 30 INSERT INTO author VALUES (18, 'Przemyslaw Dobrowolski','PD', NULL, 'dobrawka@asua.org.pl', NULL, NULL); 30 31 INSERT INTO author VALUES (19, 'Bartosz Tomasik', 'BT', NULL, 'bart-@asua.org.pl', NULL, NULL); 31 32 INSERT INTO author VALUES (20, 'Radu Trimbitas', 'RT', NULL, 'rad-@rds.ro', NULL, NULL); 32 33 INSERT INTO author VALUES (21, 'Erast V. Kunenkov', 'ER', NULL, 'eras-@tips-gw.ips.ac.ru', NULL, NULL); 33 INSERT INTO author VALUES (22, 'Ulrich Muller', 'UM', NULL, 'ulrich.moelle-@rz.hu-berlin.de', 34 INSERT INTO author VALUES (22, 'Ulrich Muller', 'UM', NULL, 'ulrich.moelle-@rz.hu-berlin.de',NULL, NULL); 34 35 INSERT INTO author VALUES (23, 'Joachim Schneider', 'JS', NULL, 'joaschneide-@debitel.net', NULL, NULL); 35 INSERT INTO author VALUES (24, 'David Raison', 'DR', NULL, 'dj-@lemur.co.uk', NULL, NULL);36 INSERT INTO author VALUES (24, 'David Raison', 'DR', 'davidr', 'djr@lemur.co.uk', NULL, NULL); 36 37 INSERT INTO author VALUES (25, 'Robert Pouliot', 'RPo', NULL, 'kryno-@clic.net', NULL, NULL); 37 INSERT INTO author VALUES (26, 'Markus Montkowski', 'MM', NULL, 'mmontkowsk -@norman.de',NULL, NULL);38 INSERT INTO author VALUES (26, 'Markus Montkowski', 'MM', NULL, 'mmontkowski@gmx.de', NULL, NULL); 38 39 INSERT INTO author VALUES (27, 'Marty ??', 'M??', NULL, 'mart-@rochester.rr.com', NULL, NULL); 39 40 INSERT INTO author VALUES (28, 'Josef Chmel', 'JCh', NULL, 'chme-@mujweb.cz', NULL, NULL); 40 41 INSERT INTO author VALUES (29, 'Lee Riemenschneider', 'LR', NULL, 'lwrieme-@wcic.cioe.com', NULL, NULL); 41 42 INSERT INTO author VALUES (30, 'Jeppe Cramon', 'JCr', NULL, 'jepp-@cramon.dk', NULL, NULL); 42 INSERT INTO author VALUES (31, 'Edgar Buerkle', 'EB', NULL, NULL,NULL, NULL);43 INSERT INTO author VALUES (32, 'Yuri Dario', 'UD', NULL, NULL,NULL, NULL);43 INSERT INTO author VALUES (31, 'Edgar Buerkle', 'EB', 'buerkle', 'Edgar.Buerkle@gmx.net', NULL, NULL); 44 INSERT INTO author VALUES (32, 'Yuri Dario', 'UD', NULL, 'mc6530@mclink.it', NULL, NULL); 44 45 INSERT INTO author VALUES (33, 'Adrian Gschwend', 'AG', NULL, NULL, NULL, NULL); 45 INSERT INTO author VALUES (34, 'Jeroen van den Horn', 'JvH', NULL, NULL, NULL, NULL); 46 -- correct cvs user? 47 INSERT INTO author VALUES (34, 'Jeroen van den Horn', 'JvH', 'hugh', 'J.vandenHorn@fibre.a2000.nl', NULL, NULL); 46 48 INSERT INTO author VALUES (35, 'Bart van Leeuwen', 'BvL', NULL, NULL, NULL, NULL); 47 49 INSERT INTO author VALUES (36, 'Nenad Milenkovic', 'NM', NULL, NULL, NULL, NULL); 48 INSERT INTO author VALUES (37, 'Michal Necasek', 'MN', NULL, NULL,NULL, NULL);49 INSERT INTO author VALUES (38, 'Vitali E. Pelenyov', 'VEP', NULL, NULL,NULL, NULL);50 INSERT INTO author VALUES (37, 'Michal Necasek', 'MN', 'mike', 'mike@mendelu.cz', NULL, NULL); 51 INSERT INTO author VALUES (38, 'Vitali E. Pelenyov', 'VEP', NULL, 'tvv@sbs.kiev.ua', NULL, NULL); 50 52 INSERT INTO author VALUES (39, 'Vit Timchishin', 'VT', NULL, NULL, NULL, NULL); 51 INSERT INTO author VALUES (40, 'Jens Wiessner', 'JW', NULL, NULL, NULL, NULL); 52 INSERT INTO author VALUES (4095,'knut st. osmundsen', 'kso', 'bird', 'knut.stange.osmundsen@pmsc.no', 'Norway', 'Oslo'); 53 INSERT INTO author VALUES (40, 'Jens Wiessner', 'JW', 'jens', 'wiessnej@rfi.de', NULL, NULL); 54 INSERT INTO author VALUES (41, 'Christian Langanke', 'CL', 'cla', 'cbratschi@datacomm.ch', NULL, NULL); 55 INSERT INTO author VALUES (4095,'knut st. osmundsen', 'kso', 'bird', 'knut.stange.osmundsen@mynd.no', 'Norway', 'Oslo'); 53 56 54 57 -
trunk/tools/database/Makefile
r3841 r3848 1 # $Id: Makefile,v 1.1 2 2000-07-18 07:35:52bird Exp $1 # $Id: Makefile,v 1.13 2000-07-18 17:56:51 bird Exp $ 2 2 3 3 # … … 111 111 # 112 112 dep: 113 $(DEPEND) $(CINCLUDES) *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \113 $(DEPEND) $(CINCLUDES) -o- *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h \ 114 114 *.c *.cpp -objo *.c *.cpp 115 115 cd gd -
trunk/tools/database/StateUpd.cpp
r3840 r3848 1 /* $Id: StateUpd.cpp,v 1.2 4 2000-07-18 07:33:13bird Exp $1 /* $Id: StateUpd.cpp,v 1.25 2000-07-18 17:56:50 bird Exp $ 2 2 * 3 3 * StateUpd - Scans source files for API functions and imports data on them. … … 68 68 static void copy(char *psz, char *pszFrom, int iFrom, char *pszTo, int iTo, char **papszLines); 69 69 static void copy(char *psz, int jFrom, int iFrom, int jTo, int iTo, char **papszLines); 70 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip );71 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip );70 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML); 71 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML); 72 72 static char *stristr(const char *pszStr, const char *pszSubStr); 73 73 static char *skipBackwards(const char *pszStopAt, const char *pszFrom, int &iLine, char **papszLines); … … 94 94 char *pszUser = "root"; 95 95 char *pszPasswd = ""; 96 ULONG ul0, ul1, ul2; 96 ULONG ul1, ul2; 97 ULONG cUpdated, cAll, cNotAliased; 97 98 98 99 DosError(0x3); … … 317 318 if (!options.fIntegrityOnly) 318 319 { 319 ul2 = dbGetNumberOfUpdatedFunction(options.lDllRefcode); 320 ul1 = dbCountFunctionInDll(options.lDllRefcode, FALSE); 321 ul0 = dbCountFunctionInDll(options.lDllRefcode, TRUE); 322 if (ul0 > ul2) 323 { 324 fprintf(phSignal, "%d functions where not found (found=%d, total=%d).\n", ul0 - ul2, ul2, ul0); 320 cUpdated = dbGetNumberOfUpdatedFunction(options.lDllRefcode); 321 cAll = dbCountFunctionInDll(options.lDllRefcode, FALSE); 322 cNotAliased = dbCountFunctionInDll(options.lDllRefcode, TRUE); 323 if (cNotAliased > cUpdated) 324 { 325 fprintf(phSignal, "%d functions where not found (found=%d, total=%d).\n", 326 cNotAliased- cUpdated, cUpdated, cNotAliased); 325 327 ulRc += 0x00010000; 326 328 } … … 330 332 fprintf(phLog, "-------------------------------------------------\n"); 331 333 fprintf(phLog, "-------------------------------------------------\n\n"); 332 fprintf(phLog,"Number of function in this DLL: %4ld (%ld)\n", ul1, ul0);333 fprintf(phLog,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), ul2);334 fprintf(phLog,"Number of function in this DLL: %4ld (%ld)\n", cAll, cNotAliased); 335 fprintf(phLog,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated); 334 336 } 335 337 fprintf(phLog,"Number of signals: %4ld\n", (long)(ulRc >> 16)); … … 344 346 if (!options.fIntegrityOnly) 345 347 { 346 fprintf(stdout,"Number of function in this DLL: %4ld (%ld)\n", ul1, ul0);347 fprintf(stdout,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), ul2);348 fprintf(stdout,"Number of function in this DLL: %4ld (%ld)\n", cAll, cNotAliased); 349 fprintf(stdout,"Number of successfully processed APIs: %4ld (%ld)\n", (long)(0x0000FFFF & ulRc), cUpdated); 348 350 } 349 351 fprintf(stdout,"Number of signals: %4ld\n", (long)(ulRc >> 16)); … … 657 659 char * psz, *psz2; 658 660 const char * pszDBFilename; 659 char * pszLastDateTime; 660 char * pszRevision; 661 char * pszAuthor; 662 signed long lLastAuthor; 661 char * pszLastDateTime = NULL; 662 char * pszRevision = NULL; 663 char * pszAuthor = NULL; 664 signed long lLastAuthor = 0; 665 unsigned long ulRc = 0; 663 666 664 667 /* … … 689 692 { /* found $Id: */ 690 693 psz2 = strchr(psz+3, '$'); 691 strncpy(&szId[0], psz, psz2 - psz); 692 szId[psz2 - psz] = '\0'; 693 iRet = i; 694 695 /* parse it! */ 696 psz = strstr(szId+4, ",v "); 697 if (psz == NULL) 698 { 699 fprintf(phSignal, "%s, module header: $Id keyword is incorrect (or the parsing code is broken).\n", pszFilename); 700 return 0x00010000; 701 } 702 pszRevision = trim(psz + 3); 703 psz = strchr(pszRevision, ' '); 704 *psz++ = '\0'; 705 trimR(pszRevision); 706 707 pszLastDateTime = trim(psz); 708 psz = strchr(strchr(pszLastDateTime, ' ') + 1, ' '); 709 *psz++ = '\0'; 710 pszLastDateTime[4] = pszLastDateTime[7] = '-'; 711 trimR(pszLastDateTime); 712 713 pszAuthor = trim(psz); 714 psz = strchr(pszAuthor, ' '); 715 *psz = '\0'; 716 lLastAuthor = dbFindAuthor(pszAuthor, NULL); 717 718 /* 719 * Is there more stuff here, in this comment? 720 * Skip to end of the current comment and copy the contents to szDescription. 721 * if szDescription suddenly contains nothing. 722 */ 723 psz = &szDescription[0]; 724 copyComment(psz, psz2+1, i, papszLines, TRUE); 725 while (*psz == '\n' && *psz == ' ') 726 psz++; 727 if (*psz == '\0') 728 { /* 729 * No description in the first comment. (The one with $Id.) 730 * Is there a comment following the first one? 694 if (psz2 != NULL && psz2 - psz > 39 && psz2 - psz < 256) 695 { 696 strncpy(&szId[0], psz, psz2 - psz); 697 szId[psz2 - psz] = '\0'; 698 iRet = i; 699 700 /* parse it! */ 701 psz = strstr(szId+4, ",v "); 702 if (psz != NULL) 703 { 704 pszRevision = trim(psz + 3); 705 psz = strchr(pszRevision, ' '); 706 *psz++ = '\0'; 707 trimR(pszRevision); 708 709 pszLastDateTime = trim(psz); 710 psz = strchr(strchr(pszLastDateTime, ' ') + 1, ' '); 711 *psz++ = '\0'; 712 pszLastDateTime[4] = pszLastDateTime[7] = '-'; 713 trimR(pszLastDateTime); 714 715 pszAuthor = trim(psz); 716 psz = strchr(pszAuthor, ' '); 717 *psz = '\0'; 718 lLastAuthor = dbFindAuthor(pszAuthor, NULL); 719 } 720 else 721 { 722 fprintf(phSignal, "%s, module header: $Id keyword is incorrect (2).\n", pszFilename); 723 ulRc += 0x00010000; 724 } 725 726 727 /* 728 * Is there more stuff here, in this comment? 729 * Skip to end of the current comment and copy the contents to szDescription. 730 * if szDescription suddenly contains nothing. 731 731 */ 732 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 733 i = i; 734 while (papszLines[i] != NULL) 735 { 736 psz2 = papszLines[i]; 737 while (*psz2 == ' ') 738 psz2++; 739 if (*psz2 != '\0') 740 break; 741 i++; 742 } 743 if (psz2 != NULL && strncmp(psz2, "/*", 2) == 0) 744 { 745 psz = &szDescription[0]; 746 copyComment(psz, psz2+1, i, papszLines, TRUE); 747 while (*psz == '\n' && *psz == ' ') 748 psz++; 749 if (psz == '\0') 750 szDescription[0] = '\0'; 751 732 psz = &szDescription[0]; 733 copyComment(psz, psz2+1, i, papszLines, TRUE, TRUE); 734 if (*psz == '\0') 735 { /* 736 * No description in the first comment. (The one with $Id.) 737 * Is there a comment following the first one? 738 */ 739 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 740 i = i; 741 while (papszLines[i] != NULL) 742 { 743 psz2 = papszLines[i]; 744 while (*psz2 == ' ') 745 psz2++; 746 if (*psz2 != '\0') 747 break; 748 i++; 749 } 750 if (psz2 != NULL && strncmp(psz2, "/*", 2) == 0) 751 { 752 psz = &szDescription[0]; 753 copyComment(psz, psz2+1, i, papszLines, TRUE, TRUE); 754 while (*psz == '\n' && *psz == ' ') 755 psz++; 756 if (psz == '\0') 757 szDescription[0] = '\0'; 758 759 /* Skip to line after comment end. */ 760 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 761 i = i; 762 } 763 } 764 else 765 { 752 766 /* Skip to line after comment end. */ 753 767 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) … … 757 771 else 758 772 { 759 /* Skip to line after comment end. */ 760 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 761 i = i; 773 fprintf(phSignal, "%s, module header: $Id keyword is incorrect (1).\n", pszFilename); 774 ulRc += 0x00010000; 762 775 } 763 776 iRet = i; 777 764 778 765 779 /* … … 774 788 */ 775 789 pOptions->lFileRefcode = dbFindFile(pOptions->lDllRefcode, pszDBFilename); 776 if (pOptions->lFileRefcode < =0)790 if (pOptions->lFileRefcode < 0) 777 791 { 778 792 fprintf(phSignal, "%s, module header: failed to find file in DB. %s\n", … … 836 850 } 837 851 else 838 copyComment(&szBuffer[0], 0, i+1, papszLines, TRUE );852 copyComment(&szBuffer[0], 0, i+1, papszLines, TRUE, TRUE); 839 853 840 854 /* Update database */ … … 1564 1578 /* find parameter */ 1565 1579 for (j = 0; j < pFnDesc->cParams; j++) 1566 if (strcmp(pFnDesc->apszParamName[j], pszParam) != 0)1580 if (strcmp(pFnDesc->apszParamName[j], pszParam) == 0) 1567 1581 break; 1568 1582 if (j < pFnDesc->cParams) … … 2532 2546 * 2533 2547 */ 2534 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip )2535 { 2536 copyComment(psz, pszFrom - papszLines[iFrom], iFrom, papszLines, fStrip );2548 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML) 2549 { 2550 copyComment(psz, pszFrom - papszLines[iFrom], iFrom, papszLines, fStrip, fHTML); 2537 2551 } 2538 2552 … … 2549 2563 * @param papszLines Array of lines. 2550 2564 * @param fStrip Strip blank lines at start and end + LICENCE notice (at end). 2565 * @param fHTML Convert to HTML while copying. 2551 2566 * @status completely implemented. 2552 2567 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 2553 2568 */ 2554 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip )2569 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip, BOOL fHTML) 2555 2570 { 2556 2571 char * pszStartBuffer = psz; /* Start of the target buffer. */ … … 2587 2602 psz = pszStart; 2588 2603 if (psz > pszStartBuffer || !fStrip) 2604 { 2605 if (fHTML) 2606 { 2607 *psz++ = '<'; 2608 *psz++ = 'B'; 2609 *psz++ = 'R'; 2610 *psz++ = '>'; 2611 } 2589 2612 *psz++ = '\n'; 2613 } 2590 2614 2591 2615 /* next */ … … 2603 2627 if (fStrip) 2604 2628 { 2629 if (fHTML) 2630 { 2631 while (psz >= pszStartBuffer) 2632 { 2633 if (*psz == ' ' || *psz == '\n' || *psz == '\0') 2634 *psz-- = '\0'; 2635 else if (psz - 4 >= pszStartBuffer && strncmp(psz - 4, "<BR>", 4) == 0) 2636 *(psz -= 4) = '\0'; 2637 else 2638 break; 2639 } 2640 } 2605 2641 while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0')) 2606 2642 *psz-- = '\0'; 2607 2643 2644 2608 2645 if (psz - 20 > pszStartBuffer && strstr(psz - 20, "LICENSE.TXT") != NULL) 2609 2646 { … … 2612 2649 } 2613 2650 2651 if (fHTML) 2652 { 2653 while (psz >= pszStartBuffer) 2654 { 2655 if (*psz == ' ' || *psz == '\n' || *psz == '\0') 2656 *psz-- = '\0'; 2657 else if (psz - 4 >= pszStartBuffer && strncmp(psz - 4, "<BR>", 4) == 0) 2658 *(psz -= 4) = '\0'; 2659 else 2660 break; 2661 } 2662 } 2614 2663 while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0')) 2615 2664 *psz-- = '\0'; -
trunk/tools/database/db.cpp
r3841 r3848 1 /* $Id: db.cpp,v 1.1 4 2000-07-18 07:34:32bird Exp $ *1 /* $Id: db.cpp,v 1.15 2000-07-18 17:56:50 bird Exp $ * 2 2 * 3 3 * DB - contains all database routines. … … 396 396 397 397 parow = mysql_fetch_row(pres); 398 if (parow != NULL)399 398 assert(parow); 399 lFile = getvalue(0, parow); 400 400 mysql_free_result(pres); 401 401 … … 1929 1929 static char *sqlstrcat(char *pszQuery, const char *pszBefore, const char *pszStr, const char *pszAfter) 1930 1930 { 1931 register char ch; 1931 char * pszLineStart = pszQuery; 1932 register char ch; 1932 1933 1933 1934 pszQuery += strlen(pszQuery); … … 1948 1949 while ((ch = *pszStr++) != '\0') 1949 1950 { 1950 if (ch == '\'') 1951 { 1952 *pszQuery++ = '\\'; 1953 *pszQuery++ = '\''; 1954 } 1955 else if (ch == '\n') 1956 { 1957 #if 0 1958 *pszQuery++ = '\\'; 1959 *pszQuery++ = 'n'; 1960 #else 1961 *pszQuery++ = '<'; 1962 *pszQuery++ = 'B'; 1963 *pszQuery++ = 'R'; 1964 *pszQuery++ = '>'; 1965 #endif 1966 } 1967 else if (ch == '\r') 1968 { 1969 #if 0 1970 *pszQuery++ = '\\'; 1971 *pszQuery++ = 'r'; 1972 #else 1973 *pszQuery++ = '<'; 1974 *pszQuery++ = 'B'; 1975 *pszQuery++ = 'R'; 1976 *pszQuery++ = '>'; 1977 #endif 1978 } 1979 else 1980 *pszQuery++ = ch; 1951 switch (ch) 1952 { 1953 case '\'': 1954 *pszQuery++ = '\\'; 1955 *pszQuery++ = '\''; 1956 break; 1957 1958 case '"': 1959 *pszQuery++ = '\\'; 1960 *pszQuery++ = '"'; 1961 break; 1962 1963 case '\\': 1964 *pszQuery++ = '\\'; 1965 *pszQuery++ = '\\'; 1966 break; 1967 1968 case '%': 1969 *pszQuery++ = '\\'; 1970 *pszQuery++ = '%'; 1971 break; 1972 1973 case '_': 1974 *pszQuery++ = '\\'; 1975 *pszQuery++ = '_'; 1976 break; 1977 1978 case '\n': 1979 *pszQuery++ = '\\'; 1980 *pszQuery++ = 'r'; 1981 *pszQuery++ = '\\'; 1982 *pszQuery++ = 'n'; 1983 break; 1984 1985 case '\t': 1986 *pszQuery++ = '\\'; 1987 *pszQuery++ = 't'; 1988 break; 1989 1990 case '\r': 1991 break; 1992 1993 default: 1994 *pszQuery++ = ch; 1995 } 1996 1997 /* Add new lines every 80 chars MySql don't like long lines. */ 1998 if (pszLineStart - pszQuery > 80) 1999 { 2000 *pszQuery = '\n'; 2001 pszLineStart = pszQuery; 2002 } 1981 2003 } 1982 2004 *pszQuery++ = '\'';
Note:
See TracChangeset
for help on using the changeset viewer.