Changeset 3838 for trunk/tools/database
- Timestamp:
- Jul 18, 2000, 9:16:01 AM (25 years ago)
- Location:
- trunk/tools/database
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/Authors.sql
r2744 r3838 1 -- $Id: Authors.sql,v 1. 2 2000-02-10 22:42:33bird Exp $1 -- $Id: Authors.sql,v 1.3 2000-07-18 07:15:56 bird Exp $ 2 2 -- 3 3 -- Insert authors. … … 9 9 DELETE FROM author; 10 10 -- refcode name initials alias email country city/location 11 INSERT INTO author VALUES ( 1, 'Sander van Leeuwen', 'SvL', NULL,'sandervl@xs4all.nl', 'the Netherlands', 'Delft');11 INSERT INTO author VALUES ( 1, 'Sander van Leeuwen', 'SvL', 'sandervl', 'sandervl@xs4all.nl', 'the Netherlands', 'Delft'); 12 12 INSERT INTO author VALUES ( 2, 'Peter Fitzsimmons', 'PF', NULL, 'pfitzsim@home.com', 'Canada', 'Mississauga, Ontario'); 13 INSERT INTO author VALUES ( 3, 'Patrick Haller', 'PT', NULL,'haller@zebra.fh-weingarten.de', 'Germany', NULL);13 INSERT INTO author VALUES ( 3, 'Patrick Haller', 'PT', 'phaller', 'haller@zebra.fh-weingarten.de', 'Germany', NULL); 14 14 INSERT INTO author VALUES ( 4, 'Joel Troster', 'JT', NULL, 'jtroster@atitech.ca', 'Canada', 'Thornhill, Ontario'); 15 15 INSERT INTO author VALUES ( 5, 'Vince Vielhaber', 'VV', NULL, 'vev@michvhf.com', 'USA', 'Oxford, MI'); -
trunk/tools/database/CreateTables.sql
r2818 r3838 1 -- $Id: CreateTables.sql,v 1. 7 2000-02-18 12:42:05bird Exp $1 -- $Id: CreateTables.sql,v 1.8 2000-07-18 07:15:57 bird Exp $ 2 2 -- 3 3 -- Create all tables. … … 8 8 USE Odin32; 9 9 10 CREATE TABLE dll ( 11 refcode TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY, 12 name VARCHAR(32) NOT NULL, 13 description VARCHAR(255), 14 UNIQUE u1(refcode), 15 UNIQUE u2(name) 16 ); 17 10 11 -- 12 -- This table holds the known states. 13 -- 18 14 CREATE TABLE state ( 19 15 refcode TINYINT NOT NULL PRIMARY KEY, … … 26 22 ); 27 23 24 25 -- 26 -- This table holds the dll names. 27 -- 28 CREATE TABLE dll ( 29 refcode TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY, 30 name VARCHAR(32) NOT NULL, 31 description VARCHAR(255), 32 UNIQUE u1(refcode), 33 UNIQUE u2(name) 34 ); 35 36 37 -- 38 -- This table holds fileinformation (per dll). 39 -- 40 CREATE TABLE file ( 41 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, 42 dll TINYINT NOT NULL, 43 name VARCHAR(128) NOT NULL, 44 lastdatetime DATETIME NOT NULL, 45 lastauthor SMALLINT NOT NULL, 46 revision CHAR(10) NOT NULL, 47 description TEXT, 48 UNIQUE u1(refcode), 49 UNIQUE u2(dll, name), 50 INDEX i1(name) 51 ); 52 53 -- 54 -- This table holds design notes (per dll). 55 -- 56 CREATE TABLE designnote ( 57 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, 58 dll TINYINT NOT NULL, 59 file INTEGER NOT NULL, 60 seqnbrfile SMALLINT NOT NULL, 61 seqnbr INTEGER NOT NULL, 62 title TEXT, 63 note TEXT NOT NULL, 64 UNIQUE u1(refcode), 65 INDEX u2(file, seqnbrfile, seqnbr, dll) 66 ); 67 68 69 -- 70 -- This table holds API information (per dll / file). 71 -- 28 72 CREATE TABLE function ( 29 73 refcode INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, 30 74 dll TINYINT NOT NULL, 31 75 aliasfn INTEGER NOT NULL DEFAULT -1, 76 file INTEGER NOT NULL DEFAULT -1, 32 77 name VARCHAR(100) NOT NULL, 33 78 intname VARCHAR(100) NOT NULL, … … 49 94 UNIQUE i2(name, dll, refcode), 50 95 UNIQUE i3(intname, dll, refcode), 96 INDEX i4(dll, file), 97 INDEX i5(file), 51 98 UNIQUE u1(refcode), 52 99 UNIQUE u2(name, dll) 53 100 ); 54 101 102 103 -- 104 -- This table holds parameters for APIs. 105 -- 106 CREATE TABLE parameter ( 107 function INTEGER NOT NULL, 108 sequencenbr TINYINT NOT NULL, 109 name VARCHAR(64) NOT NULL, 110 type VARCHAR(64) NOT NULL, 111 description TEXT, 112 INDEX i1(function, name), 113 UNIQUE u1(function, name) 114 ); 115 116 117 118 -- 119 -- Manually created Groups of APIs 120 -- 55 121 CREATE TABLE apigroup ( 56 122 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, … … 62 128 ); 63 129 130 131 -- 132 -- Manually create author table. 133 -- 64 134 CREATE TABLE author ( 65 135 refcode SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, … … 77 147 ); 78 148 149 150 -- 151 -- Many to many relation between functions and authors. 152 -- 79 153 CREATE TABLE fnauthor ( 80 154 author SMALLINT NOT NULL, … … 83 157 ); 84 158 159 160 -- 161 -- Status history for dlls. 162 -- 85 163 CREATE TABLE historydll ( 86 164 dll TINYINT NOT NULL, … … 91 169 ); 92 170 171 172 -- 173 -- Status history for API groups. 174 -- 93 175 CREATE TABLE historyapigroup ( 94 176 apigroup SMALLINT NOT NULL, … … 99 181 ); 100 182 183 184 -- 185 -- Dll API count history. 186 -- 101 187 CREATE TABLE historydlltotal ( 102 188 dll SMALLINT NOT NULL, … … 106 192 ); 107 193 194 195 -- 196 -- API Group API count history. 197 -- 108 198 CREATE TABLE historyapigrouptotal ( 109 199 apigroup SMALLINT NOT NULL, … … 113 203 ); 114 204 115 CREATE TABLE parameter ( 116 function INTEGER NOT NULL, 117 sequencenbr TINYINT NOT NULL, 118 name VARCHAR(64) NOT NULL, 119 type VARCHAR(64) NOT NULL, 120 description TEXT, 121 INDEX i1(function, name), 122 UNIQUE u1(function, name) 123 ); 124 205 -
trunk/tools/database/Makefile
r2773 r3838 1 # $Id: Makefile,v 1. 9 2000-02-14 13:49:14bird Exp $1 # $Id: Makefile,v 1.10 2000-07-18 07:16:01 bird Exp $ 2 2 3 3 # … … 15 15 CFLAGS = $(CFLAGS) -Ge+ -Tx+ -Tm- $(CINCLUDES) -DNO_CLIENT_LONG_LONG -Wall+ppt-ppc-inl-cnv-gnr-vft- -Gh+ -DDEBUG_ALLOC 16 16 CXXFLAGS = $(CXXFLAGS) -Ge+ -Gx- -Tx+ -Tm- $(CINCLUDES) -DNO_CLIENT_LONG_LONG -Wall+ppt-ppc-inl-cnv-gnr-vft- -Gh+ -DDEBUG_ALLOC 17 LDFLAGS = $(LDFLAGS) -Ge+ -Fe$@ /B"/MAP:full " $(RTLLIB) os2386.lib cppopa3.obj17 LDFLAGS = $(LDFLAGS) -Ge+ -Fe$@ /B"/MAP:full /STACK:0x50000" $(RTLLIB) os2386.lib cppopa3.obj 18 18 !else 19 19 CFLAGS = $(CFLAGS) -Ge+ -Tx+ $(CINCLUDES) -DNO_CLIENT_LONG_LONG -Wall+ppt-ppc-inl-cnv-gnr-vft- 20 20 CXXFLAGS = $(CXXFLAGS) -Ge+ -Gx- -Tx+ $(CINCLUDES) -DNO_CLIENT_LONG_LONG -Wall+ppt-ppc-inl-cnv-gnr-vft- 21 LDFLAGS = $(LDFLAGS) -Ge+ -Fe$@ /B"/MAP:full " $(RTLLIB) os2386.lib21 LDFLAGS = $(LDFLAGS) -Ge+ -Fe$@ /B"/MAP:full /STACK:0x50000" $(RTLLIB) os2386.lib 22 22 !endif 23 23 -
trunk/tools/database/StateUpd.cpp
r3115 r3838 1 /* $Id: StateUpd.cpp,v 1.2 2 2000-03-14 16:33:20bird Exp $1 /* $Id: StateUpd.cpp,v 1.23 2000-07-18 07:15:58 bird Exp $ 2 2 * 3 3 * StateUpd - Scans source files for API functions and imports data on them. … … 47 47 static unsigned long processDir(const char *pszDirOrFile, POPTIONS pOptions); 48 48 static unsigned long processFile(const char *pszFilename, POPTIONS pOptions); 49 static unsigned long processModuleHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions); 50 static unsigned long processDesignNote(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions); 49 51 static unsigned long processAPI(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions); 50 52 static unsigned long analyseFnHdr(PFNDESC pFnDesc, char **papszLines, int i, const char *pszFilename, POPTIONS pOptions); … … 54 56 static char *CommonCopyTextUntilNextTag(char *pszTarget, BOOL fHTML, int iStart, int iEnd, char **papszLines, const char *pszStart = NULL); 55 57 static BOOL isFunction(char **papszLines, int i, POPTIONS pOptions); 58 static BOOL isDesignNote(char **papszLines, int i, POPTIONS pOptions); 56 59 static long _System dbNotUpdatedCallBack(const char *pszValue, const char *pszFieldName, void *pvUser); 57 60 static char *skipInsignificantChars(char **papszLines, int &i, char *psz); … … 63 66 inline char *trimR(char *psz); 64 67 inline char *skip(const char *psz); 68 static void copy(char *psz, char *pszFrom, int iFrom, char *pszTo, int iTo, char **papszLines); 65 69 static void copy(char *psz, int jFrom, int iFrom, int jTo, int iTo, char **papszLines); 66 static void copy(char *psz, char *pszFrom, int iFrom, char *pszTo, 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); 67 72 static char *stristr(const char *pszStr, const char *pszSubStr); 68 73 static char *skipBackwards(const char *pszStopAt, const char *pszFrom, int &iLine, char **papszLines); … … 92 97 93 98 DosError(0x3); 94 DosSetPriority(PRTYS_PROCESSTREE, PRTYC_REGULAR, 1, 0);99 /*DosSetPriority(PRTYS_PROCESSTREE, PRTYC_REGULAR, 1, 0);*/ 95 100 96 101 /* get dll name from directory */ … … 264 269 options.lDllRefcode = dbGetDll(options.pszDLLName); 265 270 fprintf(phLog, "DLL: refcode=%d, name=%s\n", options.lDllRefcode, options.pszDLLName); 266 267 /* processing */ 268 if (argv[argi] == NULL || *argv[argi] == '\0') 269 ulRc = processDir(".", &options); 270 else 271 while (argv[argi] != NULL) 272 { 273 ulRc += processDir(argv[argi], &options); 274 argi++; 275 } 276 277 /* create new history rows */ 278 pszErrorDesc = (char*)malloc(1048768); assert(pszErrorDesc != NULL); 279 *pszErrorDesc = '\0'; 280 ulRc2 = dbCreateHistory(pszErrorDesc); 281 if (ulRc2 != 0) 282 { 283 fprintf(phSignal, "-,-: errors which occurred while creating history:\n\t%s\n", pszErrorDesc); 284 ulRc += ulRc2 << 16; 285 } 286 free(pszErrorDesc); 287 288 /* check db integrity */ 289 if (options.fIntegrityAfter) 290 { 271 if (options.lDllRefcode >= 0) 272 { 273 /* processing */ 274 if (argv[argi] == NULL || *argv[argi] == '\0') 275 ulRc = processDir(".", &options); 276 else 277 while (argv[argi] != NULL) 278 { 279 ulRc += processDir(argv[argi], &options); 280 argi++; 281 } 282 283 /* create new history rows */ 291 284 pszErrorDesc = (char*)malloc(1048768); assert(pszErrorDesc != NULL); 292 285 *pszErrorDesc = '\0'; 293 ulRc2 = dbC heckIntegrity(pszErrorDesc);286 ulRc2 = dbCreateHistory(pszErrorDesc); 294 287 if (ulRc2 != 0) 295 288 { 296 fprintf(phSignal, "-,-: integrity errors:\n\t%s\n", pszErrorDesc);289 fprintf(phSignal, "-,-: errors which occurred while creating history:\n\t%s\n", pszErrorDesc); 297 290 ulRc += ulRc2 << 16; 298 291 } 299 292 free(pszErrorDesc); 293 294 /* check db integrity */ 295 if (options.fIntegrityAfter) 296 { 297 pszErrorDesc = (char*)malloc(1048768); assert(pszErrorDesc != NULL); 298 *pszErrorDesc = '\0'; 299 ulRc2 = dbCheckIntegrity(pszErrorDesc); 300 if (ulRc2 != 0) 301 { 302 fprintf(phSignal, "-,-: integrity errors:\n\t%s\n", pszErrorDesc); 303 ulRc += ulRc2 << 16; 304 } 305 free(pszErrorDesc); 306 } 307 } 308 else 309 { /* failed to find dll - concidered nearly fatal. */ 310 fprintf(phSignal, "-,-: failed to find dll (%s)!\n\t%s\n", 311 options.pszDLLName ? options.pszDLLName : "<NULL>"); 312 ulRc++; 300 313 } 301 314 } … … 361 374 " -Old Use old API style. default: disabled\n" 362 375 " -OS2 Ignore 'OS2'-prefix on APIs. default: disabled\n" 363 " -Dll:<dllname> Name of the dll. default: dirname\n"376 " -Dll:<dllname> Name of the dll. default: currentdirname\n" 364 377 " -h:<hostname> Database server hostname. default: localhost\n" 365 378 " -u:<username> Username on the server. default: root\n" … … 541 554 * 2. create line array. 542 555 * (3. simple preprocessing - TODO) 543 * 4. scan thru the line array, looking for APIs. 544 * 4b. when API is found, process it. 556 * 4. process module header. 557 * 5. scan thru the line array, looking for APIs and designnotes. 558 * 5b. when API is found, process it. 559 * 5c. when designnote found, process it. 545 560 */ 546 561 static unsigned long processFile(const char *pszFilename, POPTIONS pOptions) … … 561 576 if (papszLines != NULL) 562 577 { 578 unsigned long ulRc; 563 579 int i = 0; 564 580 565 581 /* 3. - TODO */ 566 582 567 /* 4.*/ 568 while (papszLines[i] != NULL) 569 { 570 if (isFunction(papszLines, i, pOptions)) 583 /* 4. */ 584 ulRc = processModuleHeader(papszLines, i, i, pszFilename, pOptions); 585 cSignals += ulRc >> 16; 586 if (ulRc & 0x0000ffff) 587 { 588 /* 4b. 589 * Remove Design notes. 590 */ 591 pOptions->lSeqFile = 0; 592 if (!dbRemoveDesignNotes(pOptions->lFileRefcode)) 571 593 { 572 unsigned long ulRc; 573 ulRc = processAPI(papszLines, i, i, pszFilename, pOptions); 574 cAPIs += 0x0000ffff & ulRc; 575 cSignals += ulRc >> 16; 594 fprintf(phSignal, "%s: failed to remove design notes. %s\n", 595 pszFilename, dbGetLastErrorDesc()); 596 cSignals++; 576 597 } 577 else 578 i++; 598 599 600 /* 5.*/ 601 while (papszLines[i] != NULL) 602 { 603 if (isFunction(papszLines, i, pOptions)) 604 { 605 ulRc = processAPI(papszLines, i, i, pszFilename, pOptions); 606 cAPIs += 0x0000ffff & ulRc; 607 cSignals += ulRc >> 16; 608 } 609 else 610 { 611 if (isDesignNote(papszLines, i, pOptions)) 612 { 613 ulRc = processDesignNote(papszLines, i, i, pszFilename, pOptions); 614 cSignals += ulRc >> 16; 615 } 616 i++; 617 } 618 } 579 619 } 580 620 … … 598 638 return (unsigned long)((cSignals << 16) | cAPIs); 599 639 } 640 641 642 /** 643 * Processes an module header and other file information. 644 * @returns high word = number of signals. 645 * low word = Success indicator (TRUE / FALSE). 646 * @param papszLines Array of lines in the file. 647 * @param i Index into papszLines. 648 * @param iRet Index into papszLines. Where to resume search. 649 * @param pszFilename Filename. 650 * @param pOptions Pointer to options. lFileRefcode is set on successful return. 651 * @sketch Extract module information if any.... 652 */ 653 static unsigned long processModuleHeader(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions) 654 { 655 char szDescription[10240]; /* File description buffer. */ 656 char szId[128]; /* CVS Id keyword buffer. */ 657 char * psz, *psz2; 658 const char * pszDBFilename; 659 char * pszLastDateTime; 660 char * pszRevision; 661 char * pszAuthor; 662 signed long lLastAuthor; 663 664 /* 665 * Find the DB filename (skip path!) 666 */ 667 pszDBFilename = strrchr(pszFilename, '\\'); 668 psz = strrchr(pszFilename, '/'); 669 if (psz > pszDBFilename) 670 pszDBFilename = psz; 671 psz = strrchr(pszFilename, ':'); 672 if (psz > pszDBFilename) 673 pszDBFilename = psz; 674 if (pszDBFilename == NULL) 675 pszDBFilename = pszFilename; 676 else 677 pszDBFilename++; 678 679 /* 680 * The module header is either on single comment or two comments. 681 * The first line should be a "$Id" CVS keyword. (by convention). 682 * Then the module description follows. So, we'll try find the $Id 683 * keyword first. 684 */ 685 iRet = i; 686 while (i < iRet + 10 && (psz = strstr(papszLines[i], "$Id"": ")) == NULL) 687 i++; 688 if (psz != NULL) 689 { /* found $Id: */ 690 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? 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 752 /* Skip to line after comment end. */ 753 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 754 i = i; 755 } 756 } 757 else 758 { 759 /* Skip to line after comment end. */ 760 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 761 i = i; 762 } 763 iRet = i; 764 765 /* 766 * Information is collected. 767 * Insert or update the database. 768 */ 769 if (dbInsertUpdateFile((unsigned short)pOptions->lDllRefcode, pszDBFilename, 770 &szDescription[0], pszLastDateTime, lLastAuthor, pszRevision)) 771 { 772 /* 773 * Get file refcode. 774 */ 775 pOptions->lFileRefcode = dbFindFile(pOptions->lDllRefcode, pszDBFilename); 776 if (pOptions->lFileRefcode <= 0) 777 { 778 fprintf(phSignal, "%s, module header: failed to find file in DB. %s\n", 779 pszDBFilename, dbGetLastErrorDesc()); 780 return 0x00010000; 781 } 782 } 783 else 784 { 785 fprintf(phSignal, "%s, module header: failed to insert/update file. %s\n", 786 pszDBFilename, dbGetLastErrorDesc()); 787 return 0x00010000; 788 } 789 } 790 else 791 { 792 fprintf(phSignal, "%s, module header: $Id keyword is missing.\n", pszFilename); 793 return 0x00010000; 794 } 795 796 return TRUE; 797 } 798 799 800 /** 801 * Processes an API function. 802 * @returns high word = number of signals 803 * low word = Success indicator (TRUE/FALSE). 804 * @param papszLines Array of lines in the file. 805 * @param i Index into papszLines. 806 * @param iRet Index into papszLines. Where to resume search. 807 * @param pszFilename Filename used in the signal log. 808 * @param pOptions Pointer to options. 809 */ 810 static unsigned long processDesignNote(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions) 811 { 812 unsigned long ulRc; 813 char szBuffer[0x10000]; 814 char * psz; 815 816 /* 817 * Find and parse the @designnote tag/keyword. 818 * syntax: @designnote [seqnbr] <title> 819 * <text> 820 * 821 */ 822 psz = stristr(papszLines[i], "@designnote "); 823 if (psz != NULL) 824 { 825 signed long lSeqNbr; 826 827 psz = findEndOfWord(psz+1)+1; 828 lSeqNbr = atol(psz); 829 if (lSeqNbr != 0) 830 psz = findEndOfWord(psz); 831 psz = trim(psz); 832 if (psz != NULL && strstr(psz, "*/") != NULL) 833 { 834 szBuffer[0] = '\0'; 835 *strstr(psz, "*/") = '\0'; 836 } 837 else 838 copyComment(&szBuffer[0], 0, i+1, papszLines, TRUE); 839 840 /* Update database */ 841 if (!dbAddDesignNote(pOptions->lDllRefcode, pOptions->lFileRefcode, psz, &szBuffer[0], lSeqNbr, pOptions->lSeqFile++)) 842 { 843 ulRc = 0x00010000; 844 fprintf(phSignal, "%s(%d): Failed to add designnote. %s\n", dbGetLastErrorDesc()); 845 } 846 847 /* Skip to line after comment end. */ 848 while (papszLines[i] != NULL && strstr(papszLines[i++], "*/") == NULL) 849 i = i; 850 iRet = i; 851 } 852 else 853 { 854 fprintf(phSignal, "%s(%d): internal error @designnote \n", pszFilename, i); 855 ulRc = 0x00010000; 856 } 857 858 return ulRc; 859 } 860 861 600 862 601 863 … … 1808 2070 1809 2071 2072 /** 2073 * Checks if there may be a design note starting at the current line. 2074 * @returns TRUE if design note found, else FALSE. 2075 * @param papszLines Array of lines in the file. 2076 * @param i Index into papszLines. 2077 * @param pOptions Pointer to options. 2078 */ 2079 static BOOL isDesignNote(char **papszLines, int i, POPTIONS pOptions) 2080 { 2081 char *psz = papszLines[i]; 2082 2083 if (psz == NULL) 2084 return FALSE; 2085 2086 // look for /**@designnote " 2087 while (*psz == ' ') 2088 psz++; 2089 if (strncmp(psz, "/**", 3) == 0) 2090 { 2091 psz++; 2092 while (*psz == '*' || *psz == ' ') 2093 psz++; 2094 return strnicmp(psz, "@designnote ", 12) == 0; 2095 } 2096 pOptions = pOptions; 2097 return FALSE; 2098 } 2099 2100 2101 1810 2102 1811 2103 /** … … 2237 2529 2238 2530 2531 /* copyComment: Wrapper for the other copyComment function. 2532 * 2533 */ 2534 static void copyComment(char *psz, char *pszFrom, int iFrom, char **papszLines, BOOL fStrip) 2535 { 2536 copyComment(psz, pszFrom - papszLines[iFrom], iFrom, papszLines, fStrip); 2537 } 2538 2539 2540 2541 2542 /** 2543 * Copies a set of lines to a buffer (psz) stopping at the first end comment. 2544 * (If a start comment occurs it is concidered an error.) 2545 * Stars begining lines are removed. 2546 * @param psz Target buffer. 2547 * @param jFrom Starting position, index into line iFrom. 2548 * @param iFrom Starting position, index into papszLines. 2549 * @param papszLines Array of lines. 2550 * @param fStrip Strip blank lines at start and end + LICENCE notice (at end). 2551 * @status completely implemented. 2552 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 2553 */ 2554 static void copyComment(char *psz, int jFrom, int iFrom, char **papszLines, BOOL fStrip) 2555 { 2556 char * pszStartBuffer = psz; /* Start of the target buffer. */ 2557 char * pszStart = psz; /* Start of current line. */ 2558 int fFirst = TRUE; /* True while we're still processing the start of the line. */ 2559 int i, j; /* Indexes into papszLines. */ 2560 2561 i = iFrom; 2562 j = jFrom; 2563 while (papszLines[i] != NULL && !(papszLines[i][j] == '*' && papszLines[i][j+1] == '/')) 2564 { 2565 if (papszLines[i][j] != '\0') 2566 { 2567 /* Skip or copy the char ? */ 2568 if (fFirst && papszLines[i][j] == ' ') 2569 j++; 2570 else if (fFirst && papszLines[i][j] == '*') 2571 j += papszLines[i][j+1] == ' ' ? (fFirst = FALSE) + 2 : 1; /* bad habbit...*/ 2572 else 2573 { /* Copy it */ 2574 *psz++ = papszLines[i][j++]; 2575 fFirst = FALSE; 2576 } 2577 } 2578 else 2579 { /* End of line: 2580 * Check if empty line. If so truncate it. 2581 * Add new line char if not empty first line... 2582 */ 2583 j = 0; /* use this as an index from line start on the copied line. */ 2584 while (pszStart + j < psz && pszStart[j] == ' ') 2585 j++; 2586 if (pszStart + j == psz) 2587 psz = pszStart; 2588 if (psz > pszStartBuffer || !fStrip) 2589 *psz++ = '\n'; 2590 2591 /* next */ 2592 i++; 2593 j = 0; 2594 fFirst = TRUE; 2595 pszStart = psz; 2596 } 2597 } 2598 *psz = '\0'; 2599 2600 /* 2601 * Strip end + license. 2602 */ 2603 if (fStrip) 2604 { 2605 while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0')) 2606 *psz-- = '\0'; 2607 2608 if (psz - 20 > pszStartBuffer && strstr(psz - 20, "LICENSE.TXT") != NULL) 2609 { 2610 while (psz >= pszStartBuffer && *psz != '\n') 2611 *psz-- = '\0'; 2612 } 2613 2614 while (psz >= pszStartBuffer && (*psz == ' ' || *psz == '\n' || *psz == '\0')) 2615 *psz-- = '\0'; 2616 } 2617 } 2618 2619 2239 2620 /** 2240 2621 * Upcases a char. -
trunk/tools/database/StateUpd.h
r2759 r3838 1 /* $Id: StateUpd.h,v 1. 2 2000-02-11 18:35:54bird Exp $ */1 /* $Id: StateUpd.h,v 1.3 2000-07-18 07:15:58 bird Exp $ */ 2 2 /* 3 3 * StateUpd - Scans source files for API functions and imports data on them. … … 16 16 typedef struct _options 17 17 { 18 BOOL fIntegrityBefore; /* ib */ 19 BOOL fIntegrityAfter; /* ie */ 20 BOOL fIntegrityOnly; /* io */ 21 BOOL fRecursive; /* s */ 22 BOOL fOld; /* Old */ 23 BOOL fOS2; /* Ignore OS2 prefixes */ 24 BOOL fCOMCTL32; /* Ignore COMCTL32 prefixes */ 25 BOOL fVERSION; /* Ignore VERSION prefixes */ 26 char * pszDLLName; /* Name of the dll being processed */ 27 signed long lDllRefcode; /* Database reference code of the dll */ 18 BOOL fIntegrityBefore; /* ib */ 19 BOOL fIntegrityAfter; /* ie */ 20 BOOL fIntegrityOnly; /* io */ 21 BOOL fRecursive; /* s */ 22 BOOL fOld; /* Old */ 23 BOOL fOS2; /* Ignore OS2 prefixes */ 24 BOOL fCOMCTL32; /* Ignore COMCTL32 prefixes */ 25 BOOL fVERSION; /* Ignore VERSION prefixes */ 26 char * pszDLLName; /* Name of the dll being processed */ 27 signed long lDllRefcode; /* Database reference code of the dll */ 28 signed long lFileRefcode; /* File reference code. */ 29 signed long lSeqFile; /* Design note file sequence number. */ 28 30 } OPTIONS, *POPTIONS; 29 31 -
trunk/tools/database/db.cpp
r2818 r3838 1 /* $Id: db.cpp,v 1.1 1 2000-02-18 12:42:06bird Exp $ *1 /* $Id: db.cpp,v 1.12 2000-07-18 07:15:59 bird Exp $ * 2 2 * 3 3 * DB - contains all database routines. … … 351 351 352 352 353 354 /** 355 * Inserts or updates (existing) file information. 356 * @returns Success indicator (TRUE / FALSE). 357 * @param usDll Dll reference code. 358 * @param pszFilename Filename. 359 * @param pszDescription Pointer to file description. 360 * @param pszLastDateTime Date and time for last change (ISO). 361 * @param lLastAuthor Author number. (-1 if not found.) 362 * @param pszRevision Pointer to revision string. 363 * @sketch 364 * @remark 365 */ 366 BOOL _System dbInsertUpdateFile(unsigned short usDll, 367 const char *pszFilename, 368 const char *pszDescription, 369 const char *pszLastDateTime, 370 signed long lLastAuthor, 371 const char *pszRevision) 372 { 373 int rc; 374 long lFile = -1; 375 char szQuery[0x10000]; 376 MYSQL_RES *pres; 377 378 /* parameter assertions */ 379 assert(usDll != 0); 380 assert(pszFilename != NULL); 381 assert(*pszFilename != '\0'); 382 383 /* try find file */ 384 sprintf(&szQuery[0], "SELECT refcode, name FROM file WHERE dll = %d AND name = '%s'", usDll, pszFilename); 385 rc = mysql_query(pmysql, &szQuery[0]); 386 pres = mysql_store_result(pmysql); 387 if (rc >= 0 && pres != NULL && mysql_num_rows(pres) != 0) 388 { /* update file (file is found) */ 389 MYSQL_ROW parow; 390 if (mysql_num_rows(pres) > 1) 391 { 392 fprintf(stderr, "internal database integrity error(%s): More files by the same name in the same dll. " 393 "usDll = %d, pszFilename = %s\n", __FUNCTION__, usDll, pszFilename); 394 return FALSE; 395 } 396 397 parow = mysql_fetch_row(pres); 398 if (parow != NULL) 399 lFile = getvalue(0, parow); 400 mysql_free_result(pres); 401 402 if (strcmp(parow[1], pszFilename) != 0) /* case might have changed... */ 403 { 404 sprintf(&szQuery[0], "UPDATE file SET name = '%s' WHERE refcode = %ld", 405 pszFilename, lFile); 406 rc = mysql_query(pmysql, &szQuery[0]); 407 } 408 409 if (rc >= 0) 410 { 411 if (pszDescription != NULL && pszDescription != '\0') 412 { 413 szQuery[0] = '\0'; 414 sqlstrcat(&szQuery[0], "UPDATE file SET description = ", pszDescription, NULL); 415 sprintf(&szQuery[strlen(szQuery)], " WHERE refcode = %ld", lFile); 416 } 417 else 418 sprintf(&szQuery[0], "UPDATE file SET description = NULL WHERE refcode = %ld", 419 lFile); 420 rc = mysql_query(pmysql, &szQuery[0]); 421 } 422 423 if (rc >= 0 && pszLastDateTime != NULL && *pszLastDateTime != '\0') 424 { 425 sprintf(&szQuery[0], "UPDATE file SET lastdatetime = '%s' WHERE refcode = %ld", 426 pszLastDateTime, lFile); 427 rc = mysql_query(pmysql, &szQuery[0]); 428 } 429 430 if (rc >= 0) 431 { 432 sprintf(&szQuery[0], "UPDATE file SET lastauthor = %ld WHERE refcode = %ld", 433 lLastAuthor, lFile); 434 rc = mysql_query(pmysql, &szQuery[0]); 435 } 436 437 if (rc >= 0 && pszRevision != NULL && *pszRevision != '\0') 438 { 439 sprintf(&szQuery[0], "UPDATE file SET revision = '%s' WHERE refcode = %ld", 440 pszRevision, lFile); 441 rc = mysql_query(pmysql, &szQuery[0]); 442 } 443 444 } 445 else 446 { /* insert */ 447 sprintf(&szQuery[0], "INSERT INTO file(dll, name, description, lastauthor, lastdatetime, revision) VALUES(%d, '%s', %ld, ", 448 usDll, pszFilename, lLastAuthor); 449 if (pszDescription != NULL && *pszDescription != '\0') 450 sqlstrcat(&szQuery[0], NULL, pszDescription); 451 else 452 strcat(&szQuery[0], "NULL"); 453 454 if (pszLastDateTime != NULL && *pszLastDateTime != '\0') 455 sqlstrcat(&szQuery[0], ", ", pszLastDateTime); 456 else 457 strcat(&szQuery[0], ", '1975-03-13 14:00:00'"); /* dummy */ 458 459 if (pszRevision != NULL && *pszRevision != '\0') 460 sqlstrcat(&szQuery[0], ", ", pszRevision, ")"); 461 else 462 strcat(&szQuery[0], ", '')"); 463 464 rc = mysql_query(pmysql, &szQuery[0]); 465 } 466 467 return rc >= 0; 468 } 469 470 353 471 /** 354 472 * Get a long value. … … 399 517 * Find occurences of a function, given by internal name. 400 518 * @returns success indicator, TRUE / FALSE. 401 * @param pszFunctionName 402 * @param pFnFindBuf 403 * @param lDll 519 * @param pszFunctionName Pointer to a function name string. (input) 520 * @param pFnFindBuf Pointer to a find buffer. (output) 521 * @param lDll Dll refcode (optional). If given the search is limited to 522 * the given dll and aliasing functions is updated (slow!). 404 523 * @sketch 1) Get functions for this dll(if given). 405 524 * 2) Get functions which aliases the functions found in (1). … … 420 539 */ 421 540 if (lDll < 0) 422 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, name FROM function WHERE intname = '%s'",541 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function WHERE intname = '%s'", 423 542 pszFunctionName); 424 543 else 425 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, name FROM function "544 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function " 426 545 "WHERE intname = '%s' AND dll = %ld", 427 546 pszFunctionName, lDll); … … 441 560 pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]); 442 561 pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]); 443 strcpy(szFnName[pFnFindBuf->cFns], row[3]); 562 pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]); 563 strcpy(szFnName[pFnFindBuf->cFns], row[4]); 444 564 445 565 /* next */ … … 457 577 */ 458 578 cFnsThisDll = (int)pFnFindBuf->cFns; 459 strcpy(&szQuery[0], "SELECT refcode, dll, aliasfn, name FROM function WHERE aliasfn IN (");579 strcpy(&szQuery[0], "SELECT refcode, dll, aliasfn, file, name FROM function WHERE aliasfn IN ("); 460 580 for (i = 0; i < cFnsThisDll; i++) 461 581 { … … 476 596 pFnFindBuf->alDllRefCode[pFnFindBuf->cFns] = atol(row[1]); 477 597 pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = atol(row[2]); 478 strcpy(szFnName[pFnFindBuf->cFns], row[3]); 598 pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]); 599 strcpy(szFnName[pFnFindBuf->cFns], row[4]); 479 600 480 601 /* next */ … … 487 608 */ 488 609 cFnsAliasesAndThisDll = (int)pFnFindBuf->cFns; 489 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn FROM function "610 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file FROM function " 490 611 "WHERE aliasfn = (-1) AND dll <> %ld AND (intname = '%s'", 491 612 lDll, pszFunctionName); … … 508 629 else 509 630 pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = ALIAS_NULL; 631 pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]); 510 632 511 633 /* next */ … … 518 640 * 4) Get new aliases by name 519 641 */ 520 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn FROM function "642 sprintf(&szQuery[0], "SELECT refcode, dll, aliasfn, file FROM function " 521 643 "WHERE aliasfn = (-1) AND dll <> %ld AND (name = '%s'", 522 644 lDll, pszFunctionName); … … 539 661 else 540 662 pFnFindBuf->alAliasFn[pFnFindBuf->cFns] = ALIAS_NULL; 663 pFnFindBuf->alFileRefCode[pFnFindBuf->cFns] = atol(row[3]); 541 664 542 665 /* next */ … … 565 688 * 6) Update all functions from (3) and (4) to alias the first function from 1. 566 689 */ 567 sprintf(&szQuery[0], "UPDATE function SET aliasfn = (%ld) "690 sprintf(&szQuery[0], "UPDATE function SET aliasfn = (%ld), file = (%ld) " 568 691 "WHERE aliasfn = (-1) AND refcode IN (", 569 pFnFindBuf->alRefCode[0] );692 pFnFindBuf->alRefCode[0], pFnFindBuf->alFileRefCode[0]); 570 693 for (i = cFnsAliasesAndThisDll; i < pFnFindBuf->cFns; i++) 571 694 { … … 589 712 590 713 return rc >= 0; 714 } 715 716 717 /** 718 * Finds the refcode for a file (if it exists). 719 * @returns File 'refcode'. 720 * -1 on error or not found. 721 * @param lDll Refcode of the dll which this file belongs to. 722 * @param pszFilename The filename to search for. 723 */ 724 signed long _System dbFindFile(signed long lDll, const char *pszFilename) 725 { 726 char szQuery[256]; 727 MYSQL_RES * pres; 728 signed long lRefCode = -1; 729 730 assert(lDll >= 0); 731 assert(pszFilename != NULL); 732 assert(*pszFilename != '\0'); 733 734 sprintf(&szQuery[0], "SELECT refcode FROM file WHERE dll = %ld AND name = '%s'", 735 lDll, pszFilename); 736 if (mysql_query(pmysql, &szQuery[0]) >= 0) 737 { 738 pres = mysql_store_result(pmysql); 739 if (pres != NULL) 740 { 741 MYSQL_ROW parow = mysql_fetch_row(pres); 742 if (parow != NULL) 743 lRefCode = getvalue(0, parow); 744 mysql_free_result(pres); 745 } 746 } 747 748 return lRefCode; 591 749 } 592 750 … … 995 1153 996 1154 /** 1155 * Removes all the existing design notes in the specified file. 1156 * @returns Success indicator. 1157 * @param lFile File refcode of the file to remove all design notes for. 1158 * @sketch 1159 * @status 1160 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 1161 * @remark 1162 */ 1163 BOOL _System dbRemoveDesignNotes(signed long lFile) 1164 { 1165 char szQuery[80]; 1166 1167 assert(lFile >= 0); 1168 sprintf(&szQuery[0], "DELETE FROM designnote WHERE file = %ld", lFile); 1169 return mysql_query(pmysql, &szQuery[0]) >= 0; 1170 } 1171 1172 1173 /** 1174 * Adds a design note. 1175 * @returns Success indicator. 1176 * @param lDll Dll refcode. 1177 * @param lFile File refcode. 1178 * @param pszTitle Design note title. 1179 * @param pszText Design note text. 1180 * @param lSeqNbr Sequence number (in dll). If 0 the use next available number. 1181 * @param lSeqNbrFile Sequence number in file. 1182 */ 1183 BOOL _System dbAddDesignNote(signed long lDll, 1184 signed long lFile, 1185 const char *pszTitle, 1186 const char *pszText, 1187 signed long lSeqNbr, 1188 signed long lSeqNbrFile) 1189 { 1190 char szQuery[0x10200]; 1191 MYSQL_RES * pres; 1192 1193 1194 assert(lDll >= 0 && lFile >= 0); 1195 assert(lSeqNbrFile >= 0); 1196 1197 /* 1198 * If no lSqlNbr the make one. 1199 */ 1200 if (lSeqNbr == 0) 1201 { 1202 sprintf(&szQuery[0], "SELECT MAX(lSeqNbr) + 1 FROM designnote WHERE dll = %ld'", lDll); 1203 if (mysql_query(pmysql, &szQuery[0]) >= 0) 1204 { 1205 pres = mysql_store_result(pmysql); 1206 if (pres != NULL) 1207 { 1208 MYSQL_ROW parow = mysql_fetch_row(pres); 1209 if (parow != NULL) 1210 lSeqNbr = getvalue(0, parow); 1211 else 1212 lSeqNbr = 1; 1213 mysql_free_result(pres); 1214 } 1215 else 1216 return FALSE; 1217 } 1218 else 1219 return FALSE; 1220 } 1221 1222 /* 1223 * Create update query. 1224 */ 1225 sprintf(&szQuery[0], "INSERT INTO designnote(dll, file, seqnbrfile, seqnbr, title, note) " 1226 "VALUES (%ld, %ld, %ld, %ld, ", 1227 lDll, lFile, lSeqNbrFile, lSeqNbr); 1228 if (pszTitle != NULL && *pszTitle != '\0') 1229 sqlstrcat(&szQuery[0], NULL, pszTitle); 1230 else 1231 strcat(&szQuery[0], "NULL"); 1232 sqlstrcat(&szQuery[0], ", ", pszText == NULL ? "" : pszText, ")"); 1233 1234 return mysql_query(pmysql, &szQuery[0]) >= 0; 1235 } 1236 1237 1238 1239 /** 997 1240 * Updates the history tables. 998 1241 * @returns Number of signals/errors. … … 1109 1352 1110 1353 /* foreign keys in function table */ 1111 strcpy(pszQuery, "SELECT refcode, dll, state, apigroup FROM function");1354 strcpy(pszQuery, "SELECT refcode, dll, state, apigroup, file FROM function"); 1112 1355 rc = mysql_query(pmysql, pszQuery); 1113 1356 if (rc >= 0) … … 1119 1362 { 1120 1363 /* check dll */ 1121 sprintf(pszQuery, "SELECT name FROM dll WHERE refcode = %s", row1[1]);1364 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]); 1122 1365 rc = mysql_query(pmysql, pszQuery); 1123 1366 CheckFKError("function/dll", "Foreign key 'dll' not found in the dll table"); 1124 1367 1125 1368 /* check state */ 1126 sprintf(pszQuery, "SELECT name FROM state WHERE refcode = %s", row1[2]);1369 sprintf(pszQuery, "SELECT refcode FROM state WHERE refcode = %s", row1[2]); 1127 1370 rc = mysql_query(pmysql, pszQuery); 1128 1371 CheckFKError("function/state", "Foreign key 'state' not found in the state table"); … … 1131 1374 if (row1[3] != NULL) 1132 1375 { 1133 sprintf(pszQuery, "SELECT name FROM apigroup WHERE refcode = %s", row1[3]);1376 sprintf(pszQuery, "SELECT refcode FROM apigroup WHERE refcode = %s", row1[3]); 1134 1377 rc = mysql_query(pmysql, pszQuery); 1135 1378 CheckFKError("function/state", "Foreign key 'state' not found in the state table"); 1136 1379 } 1380 1381 /* check file */ 1382 if (atoi(row1[4]) >= 0) 1383 { 1384 sprintf(pszQuery, "SELECT refcode FROM file WHERE refcode = %s", row1[4]); 1385 rc = mysql_query(pmysql, pszQuery); 1386 CheckFKError("function/file", "Foreign key 'file' not found in the file table"); 1387 } 1137 1388 } 1138 1389 mysql_free_result(pres1); … … 1142 1393 ulRc += logDbError(pszError, pszQuery); 1143 1394 1144 /* foreign keys in apigroup*/1145 strcpy(pszQuery, "SELECT refcode, dll FROM apigroup");1395 /* foreign keys in file */ 1396 strcpy(pszQuery, "SELECT refcode, dll FROM file"); 1146 1397 rc = mysql_query(pmysql, pszQuery); 1147 1398 if (rc >= 0) … … 1156 1407 rc = mysql_query(pmysql, pszQuery); 1157 1408 CheckFKError("apigroup/dll", "Foreign key 'dll' not found in the dll table"); 1409 } 1410 mysql_free_result(pres1); 1411 } 1412 } 1413 else 1414 ulRc += logDbError(pszError, pszQuery); 1415 1416 /* foreign keys in apigroup */ 1417 strcpy(pszQuery, "SELECT refcode, dll FROM apigroup"); 1418 rc = mysql_query(pmysql, pszQuery); 1419 if (rc >= 0) 1420 { 1421 pres1 = mysql_store_result(pmysql); 1422 if (pres1 != NULL) 1423 { 1424 while ((row1 = mysql_fetch_row(pres1)) != NULL) 1425 { 1426 /* check dll */ 1427 sprintf(pszQuery, "SELECT refcode FROM dll WHERE refcode = %s", row1[1]); 1428 rc = mysql_query(pmysql, pszQuery); 1429 CheckFKError("file/dll", "Foreign key 'dll' not found in the dll table"); 1158 1430 } 1159 1431 mysql_free_result(pres1); … … 1646 1918 1647 1919 /** 1648 * 1920 * Appends a set of strings to a query. The main string (pszStr) is enclosed in "'"s. 1649 1921 * @returns Pointer to end of the string. 1650 1922 * @param pszQuery Outputbuffer … … 1677 1949 { 1678 1950 if (ch == '\'') 1951 { 1679 1952 *pszQuery++ = '\\'; 1680 *pszQuery++ = ch; 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; 1681 1981 } 1682 1982 *pszQuery++ = '\''; -
trunk/tools/database/db.h
r2818 r3838 1 /* $Id: db.h,v 1. 7 2000-02-18 12:42:07bird Exp $ */1 /* $Id: db.h,v 1.8 2000-07-18 07:16:00 bird Exp $ */ 2 2 /* 3 3 * DB - contains all database routines … … 19 19 * Defined Constants * 20 20 *******************************************************************************/ 21 #define NBR_PARAMETERS 30 21 22 #define NBR_FUNCTIONS 20 22 23 #define NBR_AUTHORS 20 … … 43 44 /* parameters */ 44 45 int cParams; 45 char *apszParamType[ 30];46 char *apszParamName[ 30];47 char *apszParamDesc[ 30];46 char *apszParamType[NBR_PARAMETERS]; 47 char *apszParamName[NBR_PARAMETERS]; 48 char *apszParamDesc[NBR_PARAMETERS]; 48 49 49 50 /* authors */ … … 71 72 signed long alRefCode[NBR_FUNCTIONS]; 72 73 signed long alDllRefCode[NBR_FUNCTIONS]; 73 signed long alAliasFn[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is do not mind, >= 0 ref to function. */ 74 signed long alAliasFn[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to function. */ 75 signed long alFileRefCode[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to file. */ 74 76 } FNFINDBUF, *PFNFINDBUF; 75 77 … … 99 101 unsigned long ulOrdinal, 100 102 BOOL fIgnoreOrdinal); 103 BOOL _System dbInsertUpdateFile(unsigned short usDll, 104 const char *pszFilename, 105 const char *pszDescription, 106 const char *pszLastDateTime, 107 signed long lLastAuthor, 108 const char *pszRevision); 101 109 BOOL _System dbFindFunction(const char *pszFunctionName, 102 110 PFNFINDBUF pFnFindBuf, 103 111 signed long lDll); 112 signed long _System dbFindFile(signed long lDll, const char *pszFilename); 104 113 signed long _System dbFindAuthor(const char *pszAuthor, const char *pszEmail); 105 114 signed long _System dbGetFunctionState(signed long lRefCode); … … 107 116 signed long lDll, 108 117 char *pszError); 118 BOOL _System dbRemoveDesignNotes(signed long lFile); 119 BOOL _System dbAddDesignNote(signed long lDll, 120 signed long lFile, 121 const char *pszTitle, 122 const char *pszText, 123 signed long lSeqNbr, 124 signed long lSeqNbrFile); 109 125 unsigned long _System dbCreateHistory(char *pszError); 110 126 unsigned long _System dbCheckIntegrity(char *pszError);
Note:
See TracChangeset
for help on using the changeset viewer.