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