3
* Description: See "misc.c"
5
* Comments: See "notice.txt" for copyright and license information.
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!
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.
32
#if defined(WIN_MULTITHREAD_SUPPORT)
33
#define INIT_QLOG_CS InitializeCriticalSection(&qlog_cs)
34
#define ENTER_QLOG_CS EnterCriticalSection(&qlog_cs)
35
#define LEAVE_QLOG_CS LeaveCriticalSection(&qlog_cs)
36
#define DELETE_QLOG_CS DeleteCriticalSection(&qlog_cs)
37
#define INIT_MYLOG_CS InitializeCriticalSection(&mylog_cs)
38
#define ENTER_MYLOG_CS EnterCriticalSection(&mylog_cs)
39
#define LEAVE_MYLOG_CS LeaveCriticalSection(&mylog_cs)
40
#define DELETE_MYLOG_CS DeleteCriticalSection(&mylog_cs)
41
#elif defined(POSIX_MULTITHREAD_SUPPORT)
42
#define INIT_QLOG_CS pthread_mutex_init(&qlog_cs,0)
43
#define ENTER_QLOG_CS pthread_mutex_lock(&qlog_cs)
44
#define LEAVE_QLOG_CS pthread_mutex_unlock(&qlog_cs)
45
#define DELETE_QLOG_CS pthread_mutex_destroy(&qlog_cs)
46
#define INIT_MYLOG_CS pthread_mutex_init(&mylog_cs,0)
47
#define ENTER_MYLOG_CS pthread_mutex_lock(&mylog_cs)
48
#define LEAVE_MYLOG_CS pthread_mutex_unlock(&mylog_cs)
49
#define DELETE_MYLOG_CS pthread_mutex_destroy(&mylog_cs)
54
#define DELETE_QLOG_CS
56
#define ENTER_MYLOG_CS
57
#define LEAVE_MYLOG_CS
58
#define DELETE_MYLOG_CS
59
#endif /* WIN_MULTITHREAD_SUPPORT */
62
#define MYLOGFILE "mylog_"
64
#define MYLOGDIR "/tmp"
68
extern void mylog(char *fmt,...);
72
#define mylog(args...) /* GNU convention for variable arguments */
74
extern void MyLog(char *fmt,...);
75
#define mylog if (0) MyLog /* mylog */
78
#define inolog mylog /* for really temporary debug */
81
#define QLOGFILE "psqlodbc_"
83
#define QLOGDIR "/tmp"
87
extern void qlog(char *fmt,...);
91
#define qlog(args...) /* GNU convention for variable arguments */
93
#define qlog /* qlog */
101
#define DIRSEPARATOR "/"
103
#define DIRSEPARATOR "\\"
107
#define PG_BINARY O_BINARY
108
#define PG_BINARY_R "rb"
109
#define PG_BINARY_W "wb"
110
#define PG_BINARY_A "ab"
113
#define PG_BINARY_R "r"
114
#define PG_BINARY_W "w"
115
#define PG_BINARY_A "a"
119
void remove_newlines(char *string);
120
char *strncpy_null(char *dst, const char *src, int len);
121
char *trim(char *string);
122
char *make_string(const char *s, int len, char *buf);
123
char *make_lstring_ifneeded(ConnectionClass *, const char *s, int len, BOOL);
124
char *my_strcat(char *buf, const char *fmt, const char *s, int len);
125
char *schema_strcat(char *buf, const char *fmt, const char *s, int len,
126
const char *, int, ConnectionClass *conn);
127
char *my_strcat1(char *buf, const char *fmt, const char *s1, const char *s, int len);
128
char *schema_strcat1(char *buf, const char *fmt, const char *s1,
129
const char *s, int len,
130
const char *, int, ConnectionClass *conn);
131
/* #define GET_SCHEMA_NAME(nspname) (stricmp(nspname, "public") ? nspname : "") */
132
#define GET_SCHEMA_NAME(nspname) (nspname)
134
/* defines for return value of my_strcpy */
135
#define STRCPY_SUCCESS 1
136
#define STRCPY_FAIL 0
137
#define STRCPY_TRUNCATED (-1)
138
#define STRCPY_NULL (-2)
140
int my_strcpy(char *dst, int dst_len, const char *src, int src_len);
142
/* Define a type for defining a constant string expression */
143
#define CSTR static const char * const