]>
Commit | Line | Data |
---|---|---|
1 | /** Load driver and resolve driver's function entry point | |
2 | ||
3 | Copyright (C) 1995 by Ke Jin <kejin@empress.com> | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | **/ | |
15 | ||
16 | ||
17 | #include <../iodbc/iodbc.h> | |
18 | ||
19 | #include <../iodbc/isql.h> | |
20 | #include <../iodbc/isqlext.h> | |
21 | ||
22 | #include <../iodbc/dlproc.h> | |
23 | ||
24 | #include <../iodbc/herr.h> | |
25 | #include <../iodbc/henv.h> | |
26 | #include <../iodbc/hdbc.h> | |
27 | ||
28 | #include <../iodbc/itrace.h> | |
29 | ||
30 | #include "../iodbc/henv.ci" | |
31 | ||
32 | HPROC _iodbcdm_getproc( HDBC hdbc, int idx ) | |
33 | { | |
34 | DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; | |
35 | ENV_t FAR* penv; | |
36 | HDLL hdll; | |
37 | static HPROC FAR* phproc; | |
38 | ||
39 | if( idx <= 0 || idx > SQL_EXT_API_LAST ) | |
40 | /* first entry never used */ | |
41 | { | |
42 | return SQL_NULL_HPROC; | |
43 | } | |
44 | ||
45 | penv = (ENV_t FAR*)(pdbc->henv); | |
46 | ||
47 | if( penv == NULL ) | |
48 | { | |
49 | return SQL_NULL_HPROC; | |
50 | } | |
51 | ||
52 | phproc = penv->dllproc_tab + idx; | |
53 | ||
54 | if( *phproc == SQL_NULL_HPROC ) | |
55 | { | |
56 | int i, en_idx; | |
57 | ||
58 | for( i=0 ; ; i++ ) | |
59 | { | |
60 | en_idx = odbcapi_symtab[i].en_idx; | |
61 | ||
62 | if( en_idx == en_NullProc ) | |
63 | { | |
64 | break; | |
65 | } | |
66 | ||
67 | if( en_idx == idx ) | |
68 | { | |
69 | *phproc = _iodbcdm_dllproc( penv->hdll, | |
70 | odbcapi_symtab[i].symbol ); | |
71 | ||
72 | break; | |
73 | } | |
74 | } | |
75 | } | |
76 | ||
77 | return *phproc; | |
78 | } | |
79 | ||
80 | HDLL _iodbcdm_dllopen( char FAR* path ) | |
81 | { | |
82 | return (HDLL)DLL_OPEN( path ); | |
83 | } | |
84 | ||
85 | HPROC _iodbcdm_dllproc( HDLL hdll, char FAR* sym ) | |
86 | { | |
87 | return (HPROC)DLL_PROC( hdll, sym ); | |
88 | } | |
89 | ||
90 | int _iodbcdm_dllclose( HDLL hdll ) | |
91 | { | |
92 | DLL_CLOSE( hdll ); | |
93 | ||
94 | return 0; | |
95 | } | |
96 | ||
97 | char* _iodbcdm_dllerror( ) | |
98 | { | |
99 | return DLL_ERROR(); | |
100 | } |