]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/itrace.c
apparently unneeded temporary iterator variable removed (patch 1096066)
[wxWidgets.git] / src / iodbc / itrace.c
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"
39
40 #include <stdio.h>
41
42 static int
43 printreturn (void FAR * istm, int ret)
44 {
45 FILE FAR *stm = (FILE FAR *) istm;
46 char FAR *ptr = "Invalid return value";
47
48 switch (ret)
49 {
50 case SQL_SUCCESS:
51 ptr = "SQL_SUCCESS";
52 break;
53
54 case SQL_SUCCESS_WITH_INFO:
55 ptr = "SQL_SUCCESS_WITH_INFO";
56 break;
57
58 case SQL_NO_DATA_FOUND:
59 ptr = "SQL_NO_DATA_FOUND";
60 break;
61
62 case SQL_NEED_DATA:
63 ptr = "SQL_NEED_DATA";
64 break;
65
66 case SQL_INVALID_HANDLE:
67 ptr = "SQL_INVALID_HANDLE";
68 break;
69
70 case SQL_ERROR:
71 ptr = "SQL_ERROR";
72 break;
73
74 case SQL_STILL_EXECUTING:
75 ptr = "SQL_STILL_EXECUTING";
76 break;
77
78 default:
79 break;
80 }
81
82 fprintf (stm, "%s\n", ptr);
83 fflush (stm);
84
85 return 0;
86 }
87
88
89 HPROC
90 _iodbcdm_gettrproc (void FAR * istm, int procid, int type)
91 {
92 FILE FAR *stm = (FILE FAR *) istm;
93
94 if (type == TRACE_TYPE_DM2DRV)
95 {
96 int i, j = 0;
97
98 for (i = 0; j != en_NullProc; i++)
99 {
100 j = odbcapi_symtab[i].en_idx;
101
102 if (j == procid)
103 {
104 fprintf (stm, "\n%s ( ... )\n", odbcapi_symtab[i].symbol);
105
106 fflush (stm);
107 }
108 }
109 }
110
111 if (type == TRACE_TYPE_RETURN)
112 {
113 return (HPROC) printreturn;
114 }
115
116 return SQL_NULL_HPROC;
117 }