| 1 | /* $Id: db.h,v 1.17 2002-02-24 02:58:29 bird Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * DB - contains all database routines | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1999 knut st. osmundsen | 
|---|
| 6 | * | 
|---|
| 7 | */ | 
|---|
| 8 | #ifndef _db_h_ | 
|---|
| 9 | #define _db_h_ | 
|---|
| 10 |  | 
|---|
| 11 | #pragma pack(4) | 
|---|
| 12 |  | 
|---|
| 13 | #ifdef __cplusplus | 
|---|
| 14 | extern "C" { | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | /******************************************************************************* | 
|---|
| 19 | *   Defined Constants                                                          * | 
|---|
| 20 | *******************************************************************************/ | 
|---|
| 21 | #define NBR_PARAMETERS                  30 | 
|---|
| 22 | #define NBR_FUNCTIONS                   20 | 
|---|
| 23 | #define NBR_AUTHORS                     20 | 
|---|
| 24 |  | 
|---|
| 25 | #define ALIAS_NULL                      -1 | 
|---|
| 26 | #define ALIAS_DONTMIND                  -2 | 
|---|
| 27 |  | 
|---|
| 28 | /* type flags of function */ | 
|---|
| 29 | #define FUNCTION_ODIN32_API             'A' /* for Odin32 APIs (ie. LoadLibrary) */ | 
|---|
| 30 | #define FUNCTION_INTERNAL_ODIN32_API    'I' /* for Internal/Additional Odin32 APIs (ie. RegisterLxExe) */ | 
|---|
| 31 | #define FUNCTION_OTHER                  'O' /* for all other functions (ie. OSLibInitWSeBFileIO) */ | 
|---|
| 32 |  | 
|---|
| 33 | /* type flags of dll */ | 
|---|
| 34 | #define DLL_ODIN32_API                  'A' /* for Odin32 API dll (ie. kernel32) */ | 
|---|
| 35 | #define DLL_INTERNAL                    'I' /* for Internal Odin32 (API) dll (ie. odincrt) */ | 
|---|
| 36 | #define DLL_SUPPORT                     'S' /* for support stuff (ie. pe.exe and win32k.sys). */ | 
|---|
| 37 | #define DLL_TOOLS                       'T' /* for tools (executables and dlls) */ | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | /******************************************************************************* | 
|---|
| 41 | *   Structures and Typedefs                                                    * | 
|---|
| 42 | *******************************************************************************/ | 
|---|
| 43 | typedef struct _FunctionDescription | 
|---|
| 44 | { | 
|---|
| 45 | /* buffers */ | 
|---|
| 46 | char        szFnDclBuffer[2048]; | 
|---|
| 47 | char        szFnHdrBuffer[10240]; | 
|---|
| 48 |  | 
|---|
| 49 | /* function name and type */ | 
|---|
| 50 | char *      pszName; | 
|---|
| 51 | char *      pszReturnType; | 
|---|
| 52 | long        cRefCodes; | 
|---|
| 53 | long        alRefCode[NBR_FUNCTIONS]; | 
|---|
| 54 | signed long lImpDll; /* -1 is SQL-NULL, -2 is do not mind, >= 0 ref to dll. */ | 
|---|
| 55 |  | 
|---|
| 56 | /* parameters */ | 
|---|
| 57 | int         cParams; | 
|---|
| 58 | char *      apszParamType[NBR_PARAMETERS]; | 
|---|
| 59 | char *      apszParamName[NBR_PARAMETERS]; | 
|---|
| 60 | char *      apszParamDesc[NBR_PARAMETERS]; | 
|---|
| 61 |  | 
|---|
| 62 | /* authors */ | 
|---|
| 63 | int         cAuthors; | 
|---|
| 64 | char *      apszAuthor[NBR_AUTHORS]; | 
|---|
| 65 | long        alAuthorRefCode[NBR_AUTHORS]; | 
|---|
| 66 |  | 
|---|
| 67 | /* other description fields */ | 
|---|
| 68 | char *      pszDescription; | 
|---|
| 69 | char *      pszRemark; | 
|---|
| 70 | char *      pszReturnDesc; | 
|---|
| 71 | char *      pszSketch; | 
|---|
| 72 | char *      pszEquiv; | 
|---|
| 73 | char *      pszTime; | 
|---|
| 74 |  | 
|---|
| 75 | /* status */ | 
|---|
| 76 | char *      pszStatus; | 
|---|
| 77 | long        lStatus; | 
|---|
| 78 |  | 
|---|
| 79 | /* file */ | 
|---|
| 80 | long        lFile;              /* File refcode which this function is implemented in. */ | 
|---|
| 81 | /* -1 if not valid. */ | 
|---|
| 82 | /* line */ | 
|---|
| 83 | long        lLine;              /* Line number of the function start. */ | 
|---|
| 84 | } FNDESC, *PFNDESC; | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | typedef struct _FunctionFindBuffer | 
|---|
| 88 | { | 
|---|
| 89 | unsigned long   cFns; | 
|---|
| 90 | signed long     alRefCode[NBR_FUNCTIONS]; | 
|---|
| 91 | signed long     alDllRefCode[NBR_FUNCTIONS]; | 
|---|
| 92 | signed long     alAliasFn[NBR_FUNCTIONS];     /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to function. */ | 
|---|
| 93 | signed long     alFileRefCode[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is "do not mind", >= 0 ref to file. */ | 
|---|
| 94 | } FNFINDBUF, *PFNFINDBUF; | 
|---|
| 95 |  | 
|---|
| 96 | typedef long (_System DBCALLBACKFETCH)(const char*, const char *, void *); | 
|---|
| 97 |  | 
|---|
| 98 | /******************************************************************************* | 
|---|
| 99 | *   Exported Functions                                                         * | 
|---|
| 100 | *******************************************************************************/ | 
|---|
| 101 | char *           _System dbGetLastErrorDesc(void); | 
|---|
| 102 |  | 
|---|
| 103 | KBOOL            _System dbConnect(const char *pszHost, | 
|---|
| 104 | const char *pszUser, | 
|---|
| 105 | const char *pszPassword, | 
|---|
| 106 | const char *pszDatabase); | 
|---|
| 107 | KBOOL            _System dbDisconnect(); | 
|---|
| 108 | signed long      _System dbGetDll(const char *pszDllName); | 
|---|
| 109 | signed long      _System dbCountFunctionInDll(signed long ulDll, | 
|---|
| 110 | KBOOL fNotAliases); | 
|---|
| 111 | signed long      _System dbCheckInsertDll(const char *pszDll, char fchType); | 
|---|
| 112 | unsigned short   _System dbGet(const char *pszTable, | 
|---|
| 113 | const char *pszGetColumn, | 
|---|
| 114 | const char *pszMatch1, | 
|---|
| 115 | const char *pszMatchValue1); | 
|---|
| 116 | KBOOL            _System dbInsertUpdateFunction(signed long lDll, | 
|---|
| 117 | const char *pszFunction, | 
|---|
| 118 | const char *pszIntFunction, | 
|---|
| 119 | unsigned long ulOrdinal, | 
|---|
| 120 | KBOOL fIgnoreOrdinal, | 
|---|
| 121 | char fchType); | 
|---|
| 122 | KBOOL            _System dbInsertUpdateFile(signed long lDll, | 
|---|
| 123 | const char *pszFilename, | 
|---|
| 124 | const char *pszDescription, | 
|---|
| 125 | const char *pszLastDateTime, | 
|---|
| 126 | signed long lLastAuthor, | 
|---|
| 127 | const char *pszRevision); | 
|---|
| 128 | KBOOL            _System dbFindFunction(const char *pszFunctionName, | 
|---|
| 129 | PFNFINDBUF pFnFindBuf, | 
|---|
| 130 | signed long lDll); | 
|---|
| 131 | signed long      _System dbFindFile(signed long lDll, const char *pszFilename); | 
|---|
| 132 | signed long      _System dbFindAuthor(const char *pszAuthor, const char *pszEmail); | 
|---|
| 133 | signed long      _System dbGetFunctionState(signed long lRefCode); | 
|---|
| 134 | unsigned long    _System dbUpdateFunction(PFNDESC pFnDesc, | 
|---|
| 135 | signed long lDll, | 
|---|
| 136 | char *pszError); | 
|---|
| 137 | KBOOL            _System dbRemoveDesignNotes(signed long lFile); | 
|---|
| 138 | KBOOL            _System dbAddDesignNote(signed long lDll, | 
|---|
| 139 | signed long lFile, | 
|---|
| 140 | const char *pszTitle, | 
|---|
| 141 | const char *pszText, | 
|---|
| 142 | signed long lLevel, | 
|---|
| 143 | signed long lSeqNbr, | 
|---|
| 144 | signed long lSeqNbrNote, | 
|---|
| 145 | signed long lLine, | 
|---|
| 146 | KBOOL       fSubSection, | 
|---|
| 147 | signed long *plRefCode); | 
|---|
| 148 | unsigned long    _System dbCreateHistory(char *pszError); | 
|---|
| 149 | unsigned long    _System dbCheckIntegrity(char *pszError); | 
|---|
| 150 |  | 
|---|
| 151 | /* kHtml stuff */ | 
|---|
| 152 | void *           _System dbExecuteQuery(const char *pszQuery); | 
|---|
| 153 | signed long      _System dbQueryResultRows(void *pres); | 
|---|
| 154 | KBOOL            _System dbFreeResult(void *pres); | 
|---|
| 155 | KBOOL            _System dbFetch(void *pres, | 
|---|
| 156 | DBCALLBACKFETCH dbFetchCallBack, | 
|---|
| 157 | void *pvUser); | 
|---|
| 158 | signed long      _System dbDateToDaysAfterChrist(const char *pszDate); | 
|---|
| 159 | KBOOL            _System dbDaysAfterChristToDate(signed long ulDays, | 
|---|
| 160 | char *pszDate); | 
|---|
| 161 | /* StateUpd stuff */ | 
|---|
| 162 | KBOOL            _System dbGetNotUpdatedFunction(signed long lDll, | 
|---|
| 163 | DBCALLBACKFETCH dbFetchCallBack); | 
|---|
| 164 | signed long      _System dbGetNumberOfUpdatedFunction(signed long lDll); | 
|---|
| 165 |  | 
|---|
| 166 | /* APIImport stuff */ | 
|---|
| 167 | KBOOL            _System dbClearUpdateFlagFile(signed long lDll); | 
|---|
| 168 | KBOOL            _System dbClearUpdateFlagFunction(signed long lDll, KBOOL fAll); | 
|---|
| 169 | KBOOL            _System dbDeleteNotUpdatedFiles(signed long lDll); | 
|---|
| 170 | KBOOL            _System dbDeleteNotUpdatedFunctions(signed long lDll, KBOOL fAll); | 
|---|
| 171 |  | 
|---|
| 172 | #ifdef __cplusplus | 
|---|
| 173 | } | 
|---|
| 174 | #endif | 
|---|
| 175 |  | 
|---|
| 176 | #pragma pack() | 
|---|
| 177 |  | 
|---|
| 178 | #endif | 
|---|
| 179 |  | 
|---|