]> granicus.if.org Git - postgresql/blob - src/interfaces/odbc/misc.h
Provide some initial support for building the ODBC driver for
[postgresql] / src / interfaces / odbc / misc.h
1 /* File:                        misc.h
2  *
3  * Description:         See "misc.c"
4  *
5  * Comments:            See "notice.txt" for copyright and license information.
6  *
7  */
8
9 #ifndef __MISC_H__
10 #define __MISC_H__
11
12 #include "psqlodbc.h"
13
14 #include <stdio.h>
15
16 /*      Uncomment MY_LOG define to compile in the mylog() statements.
17         Then, debug logging will occur if 'Debug' is set to 1 in the ODBCINST.INI
18         portion of the registry.  You may have to manually add this key.
19         This logfile is intended for development use, not for an end user!
20 */
21 #define MY_LOG
22
23
24 /*      Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog).
25         This logfile contains serious log statements that are intended for an
26         end user to be able to read and understand.  It is controlled by the
27         'CommLog' flag in the ODBCINST.INI portion of the registry (see above),
28         which is manipulated on the setup/connection dialog boxes.
29 */
30 #define Q_LOG
31
32
33 #ifdef MY_LOG
34 #define MYLOGFILE                       "mylog_"
35 #ifndef WIN32
36 #define MYLOGDIR                        "/tmp"
37 #else
38 #define MYLOGDIR                        "c:"
39 #endif
40 extern void mylog(char *fmt,...);
41
42 #else
43 #ifndef WIN32
44 #define mylog(args...)                  /* GNU convention for variable arguments */
45 #else
46 #define mylog                                   /* mylog */
47 #endif
48 #endif
49
50 #ifdef Q_LOG
51 #define QLOGFILE                        "psqlodbc_"
52 #ifndef WIN32
53 #define QLOGDIR                         "/tmp"
54 #else
55 #define QLOGDIR                         "c:"
56 #endif
57 extern void qlog(char *fmt,...);
58
59 #else
60 #ifndef WIN32
61 #define qlog(args...)                   /* GNU convention for variable arguments */
62 #else
63 #define qlog                                    /* qlog */
64 #endif
65 #endif
66
67 #ifndef WIN32
68 #define DIRSEPARATOR            "/"
69 #else
70 #define DIRSEPARATOR            "\\"
71 #endif
72
73 #ifdef WIN32
74 #define PG_BINARY                       O_BINARY
75 #define PG_BINARY_R                     "rb"
76 #define PG_BINARY_W                     "wb"
77 #else
78 #define PG_BINARY                       0
79 #define PG_BINARY_R                     "r"
80 #define PG_BINARY_W                     "w"
81 #endif
82
83
84 void            remove_newlines(char *string);
85 char       *strncpy_null(char *dst, const char *src, int len);
86 char       *trim(char *string);
87 char       *make_string(const char *s, int len, char *buf);
88 char       *my_strcat(char *buf, const char *fmt, const char *s, int len);
89
90 /* defines for return value of my_strcpy */
91 #define STRCPY_SUCCESS          1
92 #define STRCPY_FAIL                     0
93 #define STRCPY_TRUNCATED        (-1)
94 #define STRCPY_NULL                     (-2)
95
96 int                     my_strcpy(char *dst, int dst_len, const char *src, int src_len);
97
98 #endif