mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 05:03:57 +00:00
fixes
This commit is contained in:
@@ -139,6 +139,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
for (const packageName of preinstallPlugins) {
|
for (const packageName of preinstallPlugins) {
|
||||||
if (this.removedPlugins.includes(packageName)) continue;
|
if (this.removedPlugins.includes(packageName)) continue;
|
||||||
|
if (installed.find((x) => x.name == packageName)) continue;
|
||||||
try {
|
try {
|
||||||
console.log('Preinstalling plugin', packageName);
|
console.log('Preinstalling plugin', packageName);
|
||||||
await this.install({ packageName });
|
await this.install({ packageName });
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { quoteFullName } = require('dbgate-tools');
|
const { quoteFullName, fullNameToString } = require('dbgate-tools');
|
||||||
const requireEngineDriver = require('../utility/requireEngineDriver');
|
const requireEngineDriver = require('../utility/requireEngineDriver');
|
||||||
|
|
||||||
async function tableReader({ connection, pureName, schemaName }) {
|
async function tableReader({ connection, pureName, schemaName }) {
|
||||||
@@ -11,13 +11,15 @@ async function tableReader({ connection, pureName, schemaName }) {
|
|||||||
const table = await driver.analyseSingleObject(pool, fullName, 'tables');
|
const table = await driver.analyseSingleObject(pool, fullName, 'tables');
|
||||||
const query = `select * from ${quoteFullName(driver.dialect, fullName)}`;
|
const query = `select * from ${quoteFullName(driver.dialect, fullName)}`;
|
||||||
if (table) {
|
if (table) {
|
||||||
console.log(`Reading table ${table.pureName}`);
|
// @ts-ignore
|
||||||
|
console.log(`Reading table ${fullNameToString(table)}`);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return await driver.readQuery(pool, query, table);
|
return await driver.readQuery(pool, query, table);
|
||||||
}
|
}
|
||||||
const view = await driver.analyseSingleObject(pool, fullName, 'views');
|
const view = await driver.analyseSingleObject(pool, fullName, 'views');
|
||||||
if (view) {
|
if (view) {
|
||||||
console.log(`Reading view ${view.pureName}`);
|
// @ts-ignore
|
||||||
|
console.log(`Reading view ${fullNameToString(view)}`);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return await driver.readQuery(pool, query, view);
|
return await driver.readQuery(pool, query, view);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
const requireEngineDriver = require("../utility/requireEngineDriver");
|
const { fullNameToString } = require('dbgate-tools');
|
||||||
|
const requireEngineDriver = require('../utility/requireEngineDriver');
|
||||||
|
|
||||||
async function tableWriter({ connection, schemaName, pureName, ...options }) {
|
async function tableWriter({ connection, schemaName, pureName, ...options }) {
|
||||||
console.log(`Write table ${schemaName}.${pureName}`);
|
console.log(`Writing table ${fullNameToString({ schemaName, pureName })}`);
|
||||||
|
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
const pool = await driver.connect(connection);
|
const pool = await driver.connect(connection);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function createBulkInsertStreamBase(driver, stream, pool, name, options):
|
|||||||
await driver.query(pool, `TRUNCATE TABLE ${fullNameQuoted}`);
|
await driver.query(pool, `TRUNCATE TABLE ${fullNameQuoted}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.columnNames = _intersection(
|
writable.columnNames = _intersection(
|
||||||
structure.columns.map((x) => x.columnName),
|
structure.columns.map((x) => x.columnName),
|
||||||
writable.structure.columns.map((x) => x.columnName)
|
writable.structure.columns.map((x) => x.columnName)
|
||||||
);
|
);
|
||||||
@@ -56,14 +56,14 @@ export function createBulkInsertStreamBase(driver, stream, pool, name, options):
|
|||||||
const dmp = driver.createDumper();
|
const dmp = driver.createDumper();
|
||||||
|
|
||||||
dmp.putRaw(`INSERT INTO ${fullNameQuoted} (`);
|
dmp.putRaw(`INSERT INTO ${fullNameQuoted} (`);
|
||||||
dmp.putCollection(',', this.columnNames, (col) => dmp.putRaw(driver.dialect.quoteIdentifier(col)));
|
dmp.putCollection(',', writable.columnNames, (col) => dmp.putRaw(driver.dialect.quoteIdentifier(col)));
|
||||||
dmp.putRaw(')\n VALUES\n');
|
dmp.putRaw(')\n VALUES\n');
|
||||||
|
|
||||||
let wasRow = false;
|
let wasRow = false;
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
if (wasRow) dmp.putRaw(',\n');
|
if (wasRow) dmp.putRaw(',\n');
|
||||||
dmp.putRaw('(');
|
dmp.putRaw('(');
|
||||||
dmp.putCollection(',', this.columnNames, (col) => dmp.putValue(row[col]));
|
dmp.putCollection(',', writable.columnNames, (col) => dmp.putValue(row[col]));
|
||||||
dmp.putRaw(')');
|
dmp.putRaw(')');
|
||||||
wasRow = true;
|
wasRow = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export function useAppObjectParams() {
|
|||||||
setOpenedConnections,
|
setOpenedConnections,
|
||||||
config,
|
config,
|
||||||
showModal,
|
showModal,
|
||||||
|
extensions,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user