@gzl10/osx-cli 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ILUPEXRP.js → chunk-AI3SXYL3.js} +44 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,55 @@
|
|
|
1
1
|
// src/services/OracleService.ts
|
|
2
|
+
import { existsSync, readdirSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
2
4
|
import oracledb from "oracledb";
|
|
5
|
+
var thickModeInitialized = false;
|
|
6
|
+
function findInstantClient() {
|
|
7
|
+
const candidates = [];
|
|
8
|
+
if (process.platform === "win32") {
|
|
9
|
+
const oracleDir = "C:\\oracle";
|
|
10
|
+
if (existsSync(oracleDir)) {
|
|
11
|
+
try {
|
|
12
|
+
const dirs = readdirSync(oracleDir).filter((d) => d.startsWith("instantclient_")).map((d) => join(oracleDir, d));
|
|
13
|
+
candidates.push(...dirs);
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (process.platform === "linux" || process.platform === "darwin") {
|
|
19
|
+
candidates.push(
|
|
20
|
+
"/opt/oracle/instantclient_21_15",
|
|
21
|
+
"/opt/oracle/instantclient_19_8",
|
|
22
|
+
join(process.env.HOME || "", "instantclient_21_15"),
|
|
23
|
+
join(process.env.HOME || "", "instantclient_19_8")
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
for (const dir of candidates) {
|
|
27
|
+
if (existsSync(dir)) {
|
|
28
|
+
return dir;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function initThickMode() {
|
|
34
|
+
if (thickModeInitialized) return true;
|
|
35
|
+
const libDir = findInstantClient();
|
|
36
|
+
if (!libDir) return false;
|
|
37
|
+
try {
|
|
38
|
+
oracledb.initOracleClient({ libDir });
|
|
39
|
+
thickModeInitialized = true;
|
|
40
|
+
console.error(`Usando Oracle Instant Client de ${libDir}`);
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
3
46
|
var OracleService = class {
|
|
4
47
|
connection = null;
|
|
5
48
|
/**
|
|
6
49
|
* Conecta a Oracle usando TNS
|
|
7
50
|
*/
|
|
8
51
|
async connect(config) {
|
|
52
|
+
initThickMode();
|
|
9
53
|
this.connection = await oracledb.getConnection({
|
|
10
54
|
user: config.user,
|
|
11
55
|
password: config.password,
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED