DCL 4.0
Loading...
Searching...
No Matches
OciModuleMain.cpp File Reference
#include <dcl/Config.h>
#include <oci.h>
#include <locale.h>
#include <dcl/_stdlib.h>
#include <dcl/Object.h>
#include <dcl/String.h>
#include <dcl/SQLCore.h>
#include "OciConnection.h"

Go to the source code of this file.

Functions

SQL::ConnectionCreateConnectionInstance ()
bool ModuleInitialize ()
bool ModuleCleanup ()

Variables

DCL_DSO_EXPORT SQL::DRIVER_MODULE DCL_DSO_ENTRY_POINT

Function Documentation

◆ CreateConnectionInstance()

SQL::Connection * CreateConnectionInstance ( )

Definition at line 53 of file OciModuleMain.cpp.

54{
55// cerr << "createDatabaseObject IB\n";
56 return (new OciConnection(_serverTitle));
57}

◆ ModuleCleanup()

bool ModuleCleanup ( )

Definition at line 79 of file OciModuleMain.cpp.

80{
81 sword status = ::OCITerminate(OCI_DEFAULT);
82/*
83 if (status != OCI_SUCCESS)
84 {
85 setErrorMessage(status, NULL, __LINE__);
86 return false;
87 }
88*/
89 if (status != OCI_SUCCESS)
90 return false;
91
92 return true;
93}

◆ ModuleInitialize()

bool ModuleInitialize ( )

Definition at line 59 of file OciModuleMain.cpp.

60{
61 // https://docs.oracle.com/cd/B13789_01/server.101/b10749/ch7progr.htm#1006615
62 // When the NLS_LANG Character Set is UTF8 or AL32UTF8 in OCI
63
64 const char* envUTF8 = "AMERICAN_AMERICA.UTF8";
65 char* lang = getenv("LANG");
66 if (!lang) {
67 lang = setlocale(LC_ALL, "");
68 }
69 if (lang) {
70 ByteString s = ByteString(lang).toLowerCase();
71 if (s.contains("ko") || s.contains("kr")) {
72 envUTF8 = "KOREAN_KOREA.UTF8";
73 }
74 }
75
76 return setenv("NLS_LANG", envUTF8, true) == 0;
77}

Variable Documentation

◆ DCL_DSO_ENTRY_POINT

DCL_DSO_EXPORT SQL::DRIVER_MODULE DCL_DSO_ENTRY_POINT
Initial value:
=
{
__T("DCL SQL Driver for Oracle Database Server"),
_serverTitle,
__T("4.0.0.0"),
}
#define __TIMESTAMP__
Definition Config.h:215
#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
bool ModuleInitialize()
bool ModuleCleanup()
SQL::Connection * CreateConnectionInstance()
#define __T(str)
Definition Object.h:44

Definition at line 98 of file OciModuleMain.cpp.

99{
100 // DCL common members
101 sizeof(SQL::DRIVER_MODULE), // structure size
105 DCL_SQL_DRIVER_MODULE, // module type
106 __T("DCL SQL Driver for Oracle Database Server"),
107
108 // private members
110 _serverTitle,
111 __T("4.0.0.0"),
115};