]>
Commit | Line | Data |
---|---|---|
cd5bf2a6 RR |
1 | /* |
2 | * itrace.c | |
3 | * | |
4 | * $Id$ | |
5 | * | |
6 | * Trace functions | |
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 <itrace.h> | |
35 | ||
36 | #include <herr.h> | |
37 | #include <henv.h> | |
38 | #include "henv.ci" | |
1a6944fd RR |
39 | |
40 | #include <stdio.h> | |
41 | ||
cd5bf2a6 RR |
42 | static int |
43 | printreturn (void FAR * istm, int ret) | |
1a6944fd | 44 | { |
cd5bf2a6 RR |
45 | FILE FAR *stm = (FILE FAR *) istm; |
46 | char FAR *ptr = "Invalid return value"; | |
7e616b10 | 47 | |
cd5bf2a6 RR |
48 | switch (ret) |
49 | { | |
50 | case SQL_SUCCESS: | |
51 | ptr = "SQL_SUCCESS"; | |
52 | break; | |
7e616b10 | 53 | |
cd5bf2a6 RR |
54 | case SQL_SUCCESS_WITH_INFO: |
55 | ptr = "SQL_SUCCESS_WITH_INFO"; | |
56 | break; | |
7e616b10 | 57 | |
cd5bf2a6 RR |
58 | case SQL_NO_DATA_FOUND: |
59 | ptr = "SQL_NO_DATA_FOUND"; | |
60 | break; | |
7e616b10 | 61 | |
cd5bf2a6 RR |
62 | case SQL_NEED_DATA: |
63 | ptr = "SQL_NEED_DATA"; | |
64 | break; | |
7e616b10 | 65 | |
cd5bf2a6 RR |
66 | case SQL_INVALID_HANDLE: |
67 | ptr = "SQL_INVALID_HANDLE"; | |
68 | break; | |
7e616b10 | 69 | |
cd5bf2a6 RR |
70 | case SQL_ERROR: |
71 | ptr = "SQL_ERROR"; | |
72 | break; | |
7e616b10 | 73 | |
cd5bf2a6 RR |
74 | case SQL_STILL_EXECUTING: |
75 | ptr = "SQL_STILL_EXECUTING"; | |
76 | break; | |
7e616b10 | 77 | |
cd5bf2a6 RR |
78 | default: |
79 | break; | |
80 | } | |
7e616b10 | 81 | |
cd5bf2a6 RR |
82 | fprintf (stm, "%s\n", ptr); |
83 | fflush (stm); | |
7e616b10 | 84 | |
cd5bf2a6 | 85 | return 0; |
1a6944fd RR |
86 | } |
87 | ||
cd5bf2a6 RR |
88 | |
89 | HPROC | |
90 | _iodbcdm_gettrproc (void FAR * istm, int procid, int type) | |
1a6944fd | 91 | { |
cd5bf2a6 | 92 | FILE FAR *stm = (FILE FAR *) istm; |
1a6944fd | 93 | |
cd5bf2a6 RR |
94 | if (type == TRACE_TYPE_DM2DRV) |
95 | { | |
96 | int i, j = 0; | |
1a6944fd | 97 | |
cd5bf2a6 RR |
98 | for (i = 0; j != en_NullProc; i++) |
99 | { | |
100 | j = odbcapi_symtab[i].en_idx; | |
1a6944fd | 101 | |
cd5bf2a6 RR |
102 | if (j == procid) |
103 | { | |
104 | fprintf (stm, "\n%s ( ... )\n", odbcapi_symtab[i].symbol); | |
1a6944fd | 105 | |
cd5bf2a6 RR |
106 | fflush (stm); |
107 | } | |
108 | } | |
109 | } | |
1a6944fd | 110 | |
cd5bf2a6 RR |
111 | if (type == TRACE_TYPE_RETURN) |
112 | { | |
113 | return (HPROC) printreturn; | |
114 | } | |
1a6944fd | 115 | |
cd5bf2a6 | 116 | return SQL_NULL_HPROC; |
1a6944fd | 117 | } |