]> git.saurik.com Git - wxWidgets.git/blame - src/iodbc/dlproc.c
Compilo.
[wxWidgets.git] / src / iodbc / dlproc.c
CommitLineData
cd5bf2a6
RR
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
88ac883a 27#include "config.h"
cd5bf2a6 28
88ac883a
VZ
29#include "isql.h"
30#include "isqlext.h"
cd5bf2a6 31
88ac883a 32#include "dlproc.h"
cd5bf2a6 33
88ac883a
VZ
34#include "herr.h"
35#include "henv.h"
36#include "hdbc.h"
cd5bf2a6 37
88ac883a 38#include "itrace.h"
cd5bf2a6
RR
39
40#include "henv.ci"
41
42HPROC
43_iodbcdm_getproc (HDBC hdbc, int idx)
1a6944fd 44{
cd5bf2a6
RR
45 DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
46 ENV_t FAR *penv;
cd5bf2a6
RR
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;
1a6944fd
RR
88}
89
cd5bf2a6
RR
90
91HDLL
92_iodbcdm_dllopen (char FAR * path)
1a6944fd 93{
cd5bf2a6 94 return (HDLL) DLL_OPEN (path);
1a6944fd
RR
95}
96
cd5bf2a6
RR
97
98HPROC
99_iodbcdm_dllproc (HDLL hdll, char FAR * sym)
1a6944fd 100{
cd5bf2a6 101 return (HPROC) DLL_PROC (hdll, sym);
1a6944fd
RR
102}
103
cd5bf2a6
RR
104
105int
106_iodbcdm_dllclose (HDLL hdll)
1a6944fd 107{
cd5bf2a6 108 DLL_CLOSE (hdll);
1a6944fd 109
cd5bf2a6 110 return 0;
1a6944fd
RR
111}
112
cd5bf2a6
RR
113
114char *
115_iodbcdm_dllerror ()
1a6944fd 116{
cd5bf2a6 117 return DLL_ERROR ();
1a6944fd 118}
cd5bf2a6 119