]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/itrace.c
Introduced wxSOCKET_INT to socket.cpp. The previous code wouldn't compile on Windows.
[wxWidgets.git] / src / iodbc / itrace.c
1 /** trace functions
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 #include <../iodbc/iodbc.h>
17
18 #include <../iodbc/isql.h>
19 #include <../iodbc/isqlext.h>
20
21 #include <../iodbc/dlproc.h>
22
23 #include <../iodbc/itrace.h>
24
25 #include <../iodbc/herr.h>
26 #include <../iodbc/henv.h>
27 #include "../iodbc/henv.ci"
28
29 #include <stdio.h>
30
31 static int printreturn(void FAR* istm, int ret )
32 {
33 FILE FAR* stm = (FILE FAR*)istm;
34 char FAR* ptr = "Invalid return value";
35
36 switch( ret )
37 {
38 case SQL_SUCCESS:
39 ptr = "SQL_SUCCESS";
40 break;
41
42 case SQL_SUCCESS_WITH_INFO:
43 ptr = "SQL_SUCCESS_WITH_INFO";
44 break;
45
46 case SQL_NO_DATA_FOUND:
47 ptr = "SQL_NO_DATA_FOUND";
48 break;
49
50 case SQL_NEED_DATA:
51 ptr = "SQL_NEED_DATA";
52 break;
53
54 case SQL_INVALID_HANDLE:
55 ptr = "SQL_INVALID_HANDLE";
56 break;
57
58 case SQL_ERROR:
59 ptr = "SQL_ERROR";
60 break;
61
62 case SQL_STILL_EXECUTING:
63 ptr = "SQL_STILL_EXECUTING";
64 break;
65
66 default:
67 break;
68 }
69
70 fprintf( stm, "%s\n", ptr);
71 fflush( stm );
72
73 return 0;
74 }
75
76 HPROC _iodbcdm_gettrproc(void FAR* istm, int procid, int type)
77 {
78 FILE FAR* stm = (FILE FAR*)istm;
79
80 if( type == TRACE_TYPE_DM2DRV )
81 {
82 int i,j = 0;
83
84 for(i=0;j != en_NullProc ;i++)
85 {
86 j = odbcapi_symtab[i].en_idx;
87
88 if( j == procid )
89 {
90 fprintf( stm, "\n%s ( ... )\n",
91 odbcapi_symtab[i].symbol);
92
93 fflush( stm );
94 }
95 }
96 }
97
98 if( type == TRACE_TYPE_RETURN )
99 {
100 return (HPROC)printreturn;
101 }
102
103 return SQL_NULL_HPROC;
104 }