try native plugin

This commit is contained in:
Rinie Kervel
2022-11-21 15:36:38 +01:00
119 changed files with 533 additions and 239 deletions

View File

@@ -48,16 +48,17 @@ const driver = {
...driverBase,
analyserClass: Analyser,
async connect({ server, port, user, password, database, useDatabaseUrl, databaseUrl, ssl }) {
// let mongoUrl = databaseUrl;
// if (!useDatabaseUrl) {
// mongoUrl = user ? `mongodb://${user}:${password}@${server}:${port}` : `mongodb://${server}:${port}`;
// if (database) mongoUrl += '/' + database;
// }
const mongoUrl = useDatabaseUrl
? databaseUrl
: user
let mongoUrl;
if (useDatabaseUrl) {
// change port to ssh tunnel port
const url = new URL(databaseUrl);
url.port = port;
mongoUrl = url.href;
} else {
mongoUrl = user
? `mongodb://${user}:${password}@${server}:${port}`
: `mongodb://${server}:${port}`;
}
const options = {
useUnifiedTopology: true,

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Jan Prochazka
Copyright (c) 2022 Rinie Kervel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -7,7 +7,7 @@
"homepage": "https://dbgate.org",
"repository": {
"type": "git",
"url": "https://github.com/dbgate/dbgate"
"url": "https://github.com/rinie/dbgate-plugin-oracle"
},
"author": "Rinie Kervel",
"keywords": [
@@ -30,11 +30,10 @@
"prepublishOnly": "yarn build"
},
"devDependencies": {
"dbgate-plugin-tools": "^1.0.7",
"dbgate-plugin-tools": "^1.0.8",
"dbgate-query-splitter": "^4.9.0",
"dbgate-tools": "^5.0.0-alpha.1",
"dbgate-tools": "^5.1.7",
"lodash": "^4.17.21",
"oracledb": "^5.0.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
}

View File

@@ -4,7 +4,8 @@ const stream = require('stream');
const driverBases = require('../frontend/drivers');
const Analyser = require('./Analyser');
//--const pg = require('pg');
const oracledb = require('oracledb');
//const oracledb = require('oracledb');
let oracledb; // native module
const { createBulkInsertStreamBase, makeUniqueColumnNames } = require('dbgate-tools');
/*
@@ -318,4 +319,10 @@ finally {
},
}));
drivers.initialize = (dbgateEnv) => {
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules.oracledb) {
oracledb = dbgateEnv.nativeModules.oracledb();
}
};
module.exports = drivers;

View File

@@ -3,4 +3,7 @@ const drivers = require('./drivers');
module.exports = {
packageName: 'dbgate-plugin-oracle',
drivers,
initialize(dbgateEnv) {
drivers.initialize(dbgateEnv);
},
};