]>
Commit | Line | Data |
---|---|---|
7e616b10 RR |
1 | /** Load driver and resolve driver's function entry point |
2 | ||
3 | Copyright (C) 1995 by Ke Jin <kejin@empress.com> | |
1a6944fd RR |
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 | ||
7e616b10 | 16 | |
1a6944fd RR |
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 | ||
7e616b10 | 32 | HPROC _iodbcdm_getproc( HDBC hdbc, int idx ) |
1a6944fd | 33 | { |
7e616b10 RR |
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; | |
1a6944fd RR |
78 | } |
79 | ||
7e616b10 | 80 | HDLL _iodbcdm_dllopen( char FAR* path ) |
1a6944fd | 81 | { |
7e616b10 | 82 | return (HDLL)DLL_OPEN( path ); |
1a6944fd RR |
83 | } |
84 | ||
7e616b10 | 85 | HPROC _iodbcdm_dllproc( HDLL hdll, char FAR* sym ) |
1a6944fd | 86 | { |
7e616b10 | 87 | return (HPROC)DLL_PROC( hdll, sym ); |
1a6944fd RR |
88 | } |
89 | ||
7e616b10 | 90 | int _iodbcdm_dllclose( HDLL hdll ) |
1a6944fd | 91 | { |
7e616b10 | 92 | DLL_CLOSE( hdll ); |
1a6944fd | 93 | |
7e616b10 | 94 | return 0; |
1a6944fd RR |
95 | } |
96 | ||
7e616b10 | 97 | char* _iodbcdm_dllerror( ) |
1a6944fd | 98 | { |
7e616b10 | 99 | return DLL_ERROR(); |
1a6944fd | 100 | } |