OSDN Git Service

Fix bit rot in pg_dump's ability to dump from 7.2 and 7.1 servers.
[pg-rex/syncrep.git] / 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 /* WIN32 */
40 extern void mylog(char *fmt,...);
41
42 #else
43 #ifndef WIN32
44 #define mylog(args...)                  /* GNU convention for variable arguments */
45 #else
46 extern void MyLog(char *fmt,...);
47 #define mylog   if (0) MyLog            /* mylog */
48 #endif /* WIN32 */
49 #endif /* MY_LOG */
50 #define inolog  mylog   /* for really temporary debug */
51
52 #ifdef Q_LOG
53 #define QLOGFILE                        "psqlodbc_"
54 #ifndef WIN32
55 #define QLOGDIR                         "/tmp"
56 #else
57 #define QLOGDIR                         "c:"
58 #endif
59 extern void qlog(char *fmt,...);
60
61 #else
62 #ifndef WIN32
63 #define qlog(args...)                   /* GNU convention for variable arguments */
64 #else
65 #define qlog                                    /* qlog */
66 #endif
67 #endif
68 #define inoqlog qlog
69
70 #ifndef WIN32
71 #define DIRSEPARATOR            "/"
72 #else
73 #define DIRSEPARATOR            "\\"
74 #endif
75
76 #ifdef WIN32
77 #define PG_BINARY                       O_BINARY
78 #define PG_BINARY_R                     "rb"
79 #define PG_BINARY_W                     "wb"
80 #define PG_BINARY_A                     "ab"
81 #else
82 #define PG_BINARY                       0
83 #define PG_BINARY_R                     "r"
84 #define PG_BINARY_W                     "w"
85 #define PG_BINARY_A                     "a"
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 char       *schema_strcat(char *buf, const char *fmt, const char *s, int len,
95                 const char *, int, ConnectionClass *conn);
96 /* #define      GET_SCHEMA_NAME(nspname)        (stricmp(nspname, "public") ? nspname : "") */
97 #define GET_SCHEMA_NAME(nspname)        (nspname)
98
99 /* defines for return value of my_strcpy */
100 #define STRCPY_SUCCESS          1
101 #define STRCPY_FAIL                     0
102 #define STRCPY_TRUNCATED        (-1)
103 #define STRCPY_NULL                     (-2)
104
105 int                     my_strcpy(char *dst, int dst_len, const char *src, int src_len);
106
107 #endif