| 1 | /* $Id: db.h,v 1.10 2000-07-18 07:35:00 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 | #define ALIAS_NULL -1
|
|---|
| 25 | #define ALIAS_DONTMIND -2
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | /*******************************************************************************
|
|---|
| 29 | * Structures and Typedefs *
|
|---|
| 30 | *******************************************************************************/
|
|---|
| 31 | typedef struct _FunctionDescription
|
|---|
| 32 | {
|
|---|
| 33 | /* buffers */
|
|---|
| 34 | char szFnDclBuffer[2048];
|
|---|
| 35 | char szFnHdrBuffer[10240];
|
|---|
| 36 |
|
|---|
| 37 | /* function name and type */
|
|---|
| 38 | char *pszName;
|
|---|
| 39 | char *pszReturnType;
|
|---|
| 40 | long cRefCodes;
|
|---|
| 41 | long alRefCode[NBR_FUNCTIONS];
|
|---|
| 42 | signed long lImpDll; /* -1 is SQL-NULL, -2 is do not mind, >= 0 ref to dll. */
|
|---|
| 43 |
|
|---|
| 44 | /* parameters */
|
|---|
| 45 | int cParams;
|
|---|
| 46 | char *apszParamType[NBR_PARAMETERS];
|
|---|
| 47 | char *apszParamName[NBR_PARAMETERS];
|
|---|
| 48 | char *apszParamDesc[NBR_PARAMETERS];
|
|---|
| 49 |
|
|---|
| 50 | /* authors */
|
|---|
| 51 | int cAuthors;
|
|---|
| 52 | char *apszAuthor[NBR_AUTHORS];
|
|---|
| 53 | long alAuthorRefCode[NBR_AUTHORS];
|
|---|
| 54 |
|
|---|
| 55 | /* other description fields */
|
|---|
| 56 | char *pszDescription;
|
|---|
| 57 | char *pszRemark;
|
|---|
| 58 | char *pszReturnDesc;
|
|---|
| 59 | char *pszSketch;
|
|---|
| 60 | char *pszEquiv;
|
|---|
| 61 | char *pszTime;
|
|---|
| 62 |
|
|---|
| 63 | /* status */
|
|---|
| 64 | char *pszStatus;
|
|---|
| 65 | long lStatus;
|
|---|
| 66 | } FNDESC, *PFNDESC;
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | typedef struct _FunctionFindBuffer
|
|---|
| 70 | {
|
|---|
| 71 | unsigned long cFns;
|
|---|
| 72 | signed long alRefCode[NBR_FUNCTIONS];
|
|---|
| 73 | signed long alDllRefCode[NBR_FUNCTIONS];
|
|---|
| 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. */
|
|---|
| 76 | } FNFINDBUF, *PFNFINDBUF;
|
|---|
| 77 |
|
|---|
| 78 | typedef long (_System DBCALLBACKFETCH)(const char*, const char *, void *);
|
|---|
| 79 |
|
|---|
| 80 | /*******************************************************************************
|
|---|
| 81 | * Exported Functions *
|
|---|
| 82 | *******************************************************************************/
|
|---|
| 83 | char * _System dbGetLastErrorDesc(void);
|
|---|
| 84 |
|
|---|
| 85 | BOOL _System dbConnect(const char *pszHost,
|
|---|
| 86 | const char *pszUser,
|
|---|
| 87 | const char *pszPassword,
|
|---|
| 88 | const char *pszDatabase);
|
|---|
| 89 | BOOL _System dbDisconnect();
|
|---|
| 90 | signed short _System dbGetDll(const char *pszDllName);
|
|---|
| 91 | signed long _System dbCountFunctionInDll(signed long ulDll,
|
|---|
| 92 | BOOL fNotAliases);
|
|---|
| 93 | signed short _System dbCheckInsertDll(const char *pszDll);
|
|---|
| 94 | unsigned short _System dbGet(const char *pszTable,
|
|---|
| 95 | const char *pszGetColumn,
|
|---|
| 96 | const char *pszMatch1,
|
|---|
| 97 | const char *pszMatchValue1);
|
|---|
| 98 | BOOL _System dbInsertUpdateFunction(unsigned short usDll,
|
|---|
| 99 | const char *pszFunction,
|
|---|
| 100 | const char *pszIntFunction,
|
|---|
| 101 | unsigned long ulOrdinal,
|
|---|
| 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);
|
|---|
| 109 | BOOL _System dbFindFunction(const char *pszFunctionName,
|
|---|
| 110 | PFNFINDBUF pFnFindBuf,
|
|---|
| 111 | signed long lDll);
|
|---|
| 112 | signed long _System dbFindFile(signed long lDll, const char *pszFilename);
|
|---|
| 113 | signed long _System dbFindAuthor(const char *pszAuthor, const char *pszEmail);
|
|---|
| 114 | signed long _System dbGetFunctionState(signed long lRefCode);
|
|---|
| 115 | unsigned long _System dbUpdateFunction(PFNDESC pFnDesc,
|
|---|
| 116 | signed long lDll,
|
|---|
| 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);
|
|---|
| 125 | unsigned long _System dbCreateHistory(char *pszError);
|
|---|
| 126 | unsigned long _System dbCheckIntegrity(char *pszError);
|
|---|
| 127 |
|
|---|
| 128 | /* kHtml stuff */
|
|---|
| 129 | void * _System dbExecuteQuery(const char *pszQuery);
|
|---|
| 130 | signed long _System dbQueryResultRows(void *pres);
|
|---|
| 131 | BOOL _System dbFreeResult(void *pres);
|
|---|
| 132 | BOOL _System dbFetch(void *pres,
|
|---|
| 133 | DBCALLBACKFETCH dbFetchCallBack,
|
|---|
| 134 | void *pvUser);
|
|---|
| 135 | signed long _System dbDateToDaysAfterChrist(const char *pszDate);
|
|---|
| 136 | BOOL _System dbDaysAfterChristToDate(signed long ulDays,
|
|---|
| 137 | char *pszDate);
|
|---|
| 138 | /* StateUpd stuff */
|
|---|
| 139 | BOOL _System dbGetNotUpdatedFunction(signed long lDll,
|
|---|
| 140 | DBCALLBACKFETCH dbFetchCallBack);
|
|---|
| 141 | signed long _System dbGetNumberOfUpdatedFunction(signed long lDll);
|
|---|
| 142 |
|
|---|
| 143 | #ifdef __cplusplus
|
|---|
| 144 | }
|
|---|
| 145 | #endif
|
|---|
| 146 |
|
|---|
| 147 | #pragma pack()
|
|---|
| 148 |
|
|---|
| 149 | #endif
|
|---|
| 150 |
|
|---|