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__
23static const wchar_t __THIS_FILE__[] = __T("dcl/sql/PgModuleMain.cpp");
24#endif
25
26/*
27#ifdef _WINDOWS
28BOOL 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
49static const wchar_t* _serverTitle = __T("PostgreSQL");
50
52{
53 return new PgConnection(_serverTitle);
54}
55
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
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
85extern "C"
86{
89{
90 // DCL common members
91 sizeof(SQL::DRIVER_MODULE), // structure size
95 DCL_SQL_DRIVER_MODULE, // module type
96 __T("DCL SQL Driver for PostgreSQL Database Server"),
97
98 // private members
100 _serverTitle,
101 __T("4.0.0.0"),
105};
106
107}
108
109__DCL_END_NAMESPACE
#define __THIS_FILE__
Definition _trace.h:14
#define __TIMESTAMP__
Definition Config.h:215
#define NULL
Definition Config.h:340
#define DCL_DSO_ENTRY_POINT
Definition Config.h:393
#define DCL_BUILD_FLAG
Definition Config.h:399
#define DCL_SQL_DRIVER_MODULE
Definition Config.h:390
#define DCL_SQL_VERSION
Definition Config.h:381
#define DCL_VERSION
Definition Config.h:376
#define DCL_DSO_EXPORT
Definition Config.h:111
bool ModuleInitialize()
bool ModuleCleanup()
SQL::Connection * CreateConnectionInstance()
#define __T(str)
Definition Object.h:44
bool ModuleInitialize()
bool ModuleCleanup()
SQL::Connection * CreateConnectionInstance()