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