1 | /* $Id: db.h,v 1.6 2000-02-12 23:54: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_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[2048];
|
---|
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 |
|
---|
48 | /* authors */
|
---|
49 | int cAuthors;
|
---|
50 | char *apszAuthor[NBR_AUTHORS];
|
---|
51 | long alAuthorRefCode[NBR_AUTHORS];
|
---|
52 |
|
---|
53 | /* status */
|
---|
54 | char *pszStatus;
|
---|
55 | long lStatus;
|
---|
56 | } FNDESC, *PFNDESC;
|
---|
57 |
|
---|
58 |
|
---|
59 | typedef struct _FunctionFindBuffer
|
---|
60 | {
|
---|
61 | unsigned long cFns;
|
---|
62 | signed long alRefCode[NBR_FUNCTIONS];
|
---|
63 | signed long alDllRefCode[NBR_FUNCTIONS];
|
---|
64 | signed long alAliasFn[NBR_FUNCTIONS]; /* -1 is SQL-NULL, -2 is do not mind, >= 0 ref to function. */
|
---|
65 | } FNFINDBUF, *PFNFINDBUF;
|
---|
66 |
|
---|
67 | typedef long (_System DBCALLBACKFETCH)(const char*, const char *, void *);
|
---|
68 |
|
---|
69 | /*******************************************************************************
|
---|
70 | * Exported Functions *
|
---|
71 | *******************************************************************************/
|
---|
72 | char * _System dbGetLastErrorDesc(void);
|
---|
73 |
|
---|
74 | BOOL _System dbConnect(const char *pszHost,
|
---|
75 | const char *pszUser,
|
---|
76 | const char *pszPassword,
|
---|
77 | const char *pszDatabase);
|
---|
78 | BOOL _System dbDisconnect();
|
---|
79 | signed short _System dbGetDll(const char *pszDllName);
|
---|
80 | signed long _System dbCountFunctionInDll(signed long ulDll,
|
---|
81 | BOOL fNotAliases);
|
---|
82 | signed short _System dbCheckInsertDll(const char *pszDll);
|
---|
83 | unsigned short _System dbGet(const char *pszTable,
|
---|
84 | const char *pszGetColumn,
|
---|
85 | const char *pszMatch1,
|
---|
86 | const char *pszMatchValue1);
|
---|
87 | BOOL _System dbInsertUpdateFunction(unsigned short usDll,
|
---|
88 | const char *pszFunction,
|
---|
89 | const char *pszIntFunction,
|
---|
90 | unsigned long ulOrdinal,
|
---|
91 | BOOL fIgnoreOrdinal);
|
---|
92 | BOOL _System dbFindFunction(const char *pszFunctionName,
|
---|
93 | PFNFINDBUF pFnFindBuf,
|
---|
94 | signed long lDll);
|
---|
95 | signed long _System dbFindAuthor(const char *pszAuthor);
|
---|
96 | signed long _System dbGetFunctionState(signed long lRefCode);
|
---|
97 | unsigned long _System dbUpdateFunction(PFNDESC pFnDesc,
|
---|
98 | signed long lDll,
|
---|
99 | char *pszError);
|
---|
100 | unsigned long _System dbCreateHistory(char *pszError);
|
---|
101 | unsigned long _System dbCheckIntegrity(char *pszError);
|
---|
102 |
|
---|
103 | /* kHtml stuff */
|
---|
104 | void * _System dbExecuteQuery(const char *pszQuery);
|
---|
105 | signed long _System dbQueryResultRows(void *pres);
|
---|
106 | BOOL _System dbFreeResult(void *pres);
|
---|
107 | BOOL _System dbFetch(void *pres,
|
---|
108 | DBCALLBACKFETCH dbFetchCallBack,
|
---|
109 | void *pvUser);
|
---|
110 | signed long _System dbDateToDaysAfterChrist(const char *pszDate);
|
---|
111 | BOOL _System dbDaysAfterChristToDate(signed long ulDays,
|
---|
112 | char *pszDate);
|
---|
113 | /* StateUpd stuff */
|
---|
114 | BOOL _System dbGetNotUpdatedFunction(signed long lDll,
|
---|
115 | DBCALLBACKFETCH dbFetchCallBack);
|
---|
116 | signed long _System dbGetNumberOfUpdatedFunction(signed long lDll);
|
---|
117 |
|
---|
118 | #ifdef __cplusplus
|
---|
119 | }
|
---|
120 | #endif
|
---|
121 |
|
---|
122 | #pragma pack()
|
---|
123 |
|
---|
124 | #endif
|
---|
125 |
|
---|