DCL
4.0
Loading...
Searching...
No Matches
PgModuleMain.cpp
Go to the documentation of this file.
1
#include <
dcl/Config.h
>
2
3
#ifdef _MSC_VER
4
#pragma comment(lib, "libecpg.lib")
5
#pragma comment(lib, "libpq.lib")
6
#pragma comment(lib, "libpgtypes.lib")
7
#endif
8
9
#include <locale.h>
10
#include <
dcl/_stdlib.h
>
11
12
#include <
dcl/Object.h
>
13
#if __DCL_HAVE_ALLOC_DEBUG
14
#undef __DCL_ALLOC_LEVEL
15
#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
16
#endif
17
18
#include <
dcl/SQLCore.h
>
19
#include "
PgConnection.h
"
20
21
#ifdef __DCL_HAVE_THIS_FILE__
22
#undef __THIS_FILE__
23
static
const
wchar_t
__THIS_FILE__
[] =
__T
(
"dcl/sql/PgModuleMain.cpp"
);
24
#endif
25
26
/*
27
#ifdef _WINDOWS
28
BOOL APIENTRY DllMain( HANDLE hModule,
29
DWORD ul_reason_for_call,
30
LPVOID lpReserved
31
)
32
{
33
switch (ul_reason_for_call)
34
{
35
case DLL_PROCESS_ATTACH:
36
case DLL_PROCESS_DETACH:
37
return TRUE;
38
case DLL_THREAD_ATTACH:
39
case DLL_THREAD_DETACH:
40
break;
41
}
42
return FALSE;
43
}
44
#endif
45
*/
46
47
__DCL_BEGIN_NAMESPACE
48
49
static
const
wchar_t
* _serverTitle =
__T
(
"PostgreSQL"
);
50
51
SQL::Connection
*
CreateConnectionInstance
()
52
{
53
return
new
PgConnection
(_serverTitle);
54
}
55
56
bool
ModuleInitialize
()
57
{
58
const
char
* envUTF8 =
"en_US.UTF-8"
;
59
char
* lang = getenv(
"LANG"
);
60
if
(!lang) {
61
lang = setlocale(LC_ALL,
""
);
62
}
63
if
(lang) {
64
ByteString s = ByteString(lang).toLowerCase();
65
if
(s.contains(
"ko"
) || s.contains(
"kr"
)) {
66
envUTF8 =
"ko_KR.UTF-8"
;
67
}
68
}
69
70
return
setenv(
"_LANG"
, envUTF8,
true
) == 0;;
71
}
72
73
bool
ModuleCleanup
()
74
{
75
#if defined(__DCL_DEBUG) && defined(_DEBUG) && defined(_WINDOWS)
76
if
(__hMSVCRT_DLL)
77
{
78
::FreeLibrary(__hMSVCRT_DLL);
79
__hMSVCRT_DLL =
NULL
;
80
}
81
#endif
82
return
true
;
83
}
84
85
extern
"C"
86
{
87
DCL_DSO_EXPORT
88
SQL::DRIVER_MODULE
DCL_DSO_ENTRY_POINT
=
89
{
90
// DCL common members
91
sizeof
(
SQL::DRIVER_MODULE
),
// structure size
92
DCL_VERSION
,
93
__T
(
__TIMESTAMP__
),
94
DCL_BUILD_FLAG
,
95
DCL_SQL_DRIVER_MODULE
,
// module type
96
__T
(
"DCL SQL Driver for PostgreSQL Database Server"
),
97
98
// private members
99
DCL_SQL_VERSION
,
100
_serverTitle,
101
__T
(
"4.0.0.0"
),
102
ModuleInitialize
,
103
ModuleCleanup
,
104
CreateConnectionInstance
105
};
106
107
}
108
109
__DCL_END_NAMESPACE
_stdlib.h
__THIS_FILE__
#define __THIS_FILE__
Definition
_trace.h:14
Config.h
__TIMESTAMP__
#define __TIMESTAMP__
Definition
Config.h:215
NULL
#define NULL
Definition
Config.h:340
DCL_DSO_ENTRY_POINT
#define DCL_DSO_ENTRY_POINT
Definition
Config.h:393
DCL_BUILD_FLAG
#define DCL_BUILD_FLAG
Definition
Config.h:399
DCL_SQL_DRIVER_MODULE
#define DCL_SQL_DRIVER_MODULE
Definition
Config.h:390
DCL_SQL_VERSION
#define DCL_SQL_VERSION
Definition
Config.h:381
DCL_VERSION
#define DCL_VERSION
Definition
Config.h:376
DCL_DSO_EXPORT
#define DCL_DSO_EXPORT
Definition
Config.h:111
ModuleInitialize
bool ModuleInitialize()
Definition
IFXModuleMain.cpp:84
ModuleCleanup
bool ModuleCleanup()
Definition
IFXModuleMain.cpp:120
CreateConnectionInstance
SQL::Connection * CreateConnectionInstance()
Definition
IFXModuleMain.cpp:79
Object.h
__T
#define __T(str)
Definition
Object.h:44
PgConnection.h
ModuleInitialize
bool ModuleInitialize()
Definition
PgModuleMain.cpp:56
ModuleCleanup
bool ModuleCleanup()
Definition
PgModuleMain.cpp:73
CreateConnectionInstance
SQL::Connection * CreateConnectionInstance()
Definition
PgModuleMain.cpp:51
SQLCore.h
PgConnection
Definition
PgConnection.h:7
SQL::Connection
Definition
SQLCore.h:310
SQL::DRIVER_MODULE
Definition
SQLCore.h:408
src
SQLPostgreSQL
PgModuleMain.cpp
Generated by
1.14.0