mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 02:06:01 +00:00
oracle thick mode available for electron app
This commit is contained in:
@@ -5,8 +5,10 @@ const driverBase = require('../frontend/driver');
|
||||
const Analyser = require('./Analyser');
|
||||
const { createBulkInsertStreamBase, makeUniqueColumnNames } = require('dbgate-tools');
|
||||
const createOracleBulkInsertStream = require('./createOracleBulkInsertStream');
|
||||
const { platform } = require('os');
|
||||
|
||||
let requireOracledb;
|
||||
let platformInfo;
|
||||
|
||||
let oracledbValue;
|
||||
function getOracledb() {
|
||||
@@ -16,7 +18,6 @@ function getOracledb() {
|
||||
return oracledbValue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
pg.types.setTypeParser(1082, 'text', val => val); // date
|
||||
pg.types.setTypeParser(1114, 'text', val => val); // timestamp without timezone
|
||||
@@ -327,23 +328,26 @@ const driver = {
|
||||
},
|
||||
|
||||
getAuthTypes() {
|
||||
return [
|
||||
{
|
||||
title: 'Thin mode (default) - direct connection to Oracle database',
|
||||
name: 'thin',
|
||||
},
|
||||
{
|
||||
title: 'Thick mode - connection via Oracle instant client',
|
||||
name: 'thick',
|
||||
},
|
||||
];
|
||||
if (platformInfo?.isElectron || process.env.ORACLE_INSTANT_CLIENT) {
|
||||
return [
|
||||
{
|
||||
title: 'Thin mode (default) - direct connection to Oracle database',
|
||||
name: 'thin',
|
||||
},
|
||||
{
|
||||
title: 'Thick mode - connection via Oracle instant client',
|
||||
name: 'thick',
|
||||
},
|
||||
];
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
driver.initialize = (dbgateEnv) => {
|
||||
driver.initialize = dbgateEnv => {
|
||||
if (dbgateEnv.nativeModules && dbgateEnv.nativeModules['oracledb']) {
|
||||
requireOracledb = dbgateEnv.nativeModules['oracledb'];
|
||||
}
|
||||
platformInfo = dbgateEnv.platformInfo;
|
||||
};
|
||||
|
||||
module.exports = driver;
|
||||
|
||||
@@ -98,11 +98,10 @@ const oracleDriver = {
|
||||
|
||||
databaseUrlPlaceholder: 'e.g. localhost:1521/orcl',
|
||||
|
||||
|
||||
showConnectionField: (field, values) => {
|
||||
showConnectionField: (field, values, { config }) => {
|
||||
if (field == 'useDatabaseUrl') return true;
|
||||
if (field == 'authType') return true;
|
||||
if (field == 'clientLibraryPath') return values.authType == 'thick';
|
||||
if (field == 'clientLibraryPath') return config?.isElectron && values.authType == 'thick';
|
||||
|
||||
if (values.useDatabaseUrl) {
|
||||
return ['databaseUrl', 'user', 'password'].includes(field);
|
||||
|
||||
Reference in New Issue
Block a user