]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/dlproc.c
Include wx/log.h according to precompiled headers of wx/wx.h (with other minor cleaning).
[wxWidgets.git] / src / iodbc / dlproc.c
1 /*
2 * dlproc.c
3 *
4 * $Id$
5 *
6 * Load driver and resolve driver's function entry point
7 *
8 * The iODBC driver manager.
9 *
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27 #include "config.h"
28
29 #include "isql.h"
30 #include "isqlext.h"
31
32 #include "dlproc.h"
33
34 #include "herr.h"
35 #include "henv.h"
36 #include "hdbc.h"
37
38 #include "itrace.h"
39
40 #include "henv.ci"
41
42 HPROC
43 _iodbcdm_getproc (HDBC hdbc, int idx)
44 {
45 DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
46 ENV_t FAR *penv;
47 HPROC FAR *phproc;
48
49 if (idx <= 0 || idx > SQL_EXT_API_LAST)
50 /* first entry naver used */
51 {
52 return SQL_NULL_HPROC;
53 }
54
55 penv = (ENV_t FAR *) (pdbc->henv);
56
57 if (penv == NULL)
58 {
59 return SQL_NULL_HPROC;
60 }
61
62 phproc = penv->dllproc_tab + idx;
63
64 if (*phproc == SQL_NULL_HPROC)
65 {
66 int i, en_idx;
67
68 for (i = 0;; i++)
69 {
70 en_idx = odbcapi_symtab[i].en_idx;
71
72 if (en_idx == en_NullProc)
73 {
74 break;
75 }
76
77 if (en_idx == idx)
78 {
79 *phproc = _iodbcdm_dllproc (penv->hdll,
80 odbcapi_symtab[i].symbol);
81
82 break;
83 }
84 }
85 }
86
87 return *phproc;
88 }
89
90
91 HDLL
92 _iodbcdm_dllopen (char FAR * path)
93 {
94 return (HDLL) DLL_OPEN (path);
95 }
96
97
98 HPROC
99 _iodbcdm_dllproc (HDLL hdll, char FAR * sym)
100 {
101 return (HPROC) DLL_PROC (hdll, sym);
102 }
103
104
105 int
106 _iodbcdm_dllclose (HDLL hdll)
107 {
108 DLL_CLOSE (hdll);
109
110 return 0;
111 }
112
113
114 char *
115 _iodbcdm_dllerror ()
116 {
117 return DLL_ERROR ();
118 }
119