-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.h
74 lines (62 loc) · 2.19 KB
/
Main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* https://www.firebirdsql.org/en/initial-developer-s-public-license-version-1-0/
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
* The Original Code was created by Vladimir Tsvigun for IBPhoenix.
*
* Copyright (c) 2004 Vladimir Tsvigun
* All Rights Reserved.
*/
#if !defined(_MAIN_H_INCLUDED_)
#define _MAIN_H_INCLUDED_
void trace (const char *msg);
#ifdef _WINDOWS
#define OUTPUT_MONITOR_EXECUTING(msg) OutputDebugString(msg"\n");
#else
#define OUTPUT_MONITOR_EXECUTING(msg)
#endif
#ifdef DEBUG
#define TRACE(msg) trace (msg"\n")
#else
#ifdef __MONITOR_EXECUTING
#define TRACE(msg) OUTPUT_MONITOR_EXECUTING(msg)
#else
#define TRACE(msg)
#endif
#endif
#if(DRIVER_LOCKED_LEVEL == DRIVER_LOCKED_LEVEL_ENV)
#define GUARD SafeDllThread wt
#define GUARD_ENV(arg) GUARD
#define GUARD_HSTMT(arg) GUARD
#define GUARD_HDBC(arg) GUARD
#define GUARD_HDESC(arg) GUARD
#define GUARD_HTYPE(arg1,arg2) GUARD
#elif(DRIVER_LOCKED_LEVEL == DRIVER_LOCKED_LEVEL_CONNECT)
#define GUARD SafeDllThread wt
#define GUARD_ENV(arg) SafeEnvThread wt((OdbcEnv*)arg)
#define GUARD_HSTMT(arg) SafeConnectThread wt(((OdbcStatement*)arg)->connection)
#define GUARD_HDBC(arg) SafeConnectThread wt((OdbcConnection*)arg)
#define GUARD_HDESC(arg) SafeConnectThread wt(((OdbcDesc*)arg)->connection)
#define GUARD_HTYPE(arg,arg1) SafeConnectThread wt( \
arg1==SQL_HANDLE_DBC ? (OdbcConnection*)arg: \
arg1==SQL_HANDLE_STMT ? ((OdbcStatement*)arg)->connection: \
arg1==SQL_HANDLE_DESC ? ((OdbcDesc*)arg)->connection : NULL )
#else
#define GUARD
#define GUARD_ENV(arg)
#define GUARD_HSTMT(arg)
#define GUARD_HDBC(arg)
#define GUARD_HDESC(arg)
#define GUARD_HTYPE(arg1,arg2)
#endif
#endif // !defined(_MAIN_H_INCLUDED_)