mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 02:06:01 +00:00
import from postgres dump
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"cross-env": "^6.0.3",
|
"cross-env": "^6.0.3",
|
||||||
"dbgate-datalib": "^5.0.0-alpha.1",
|
"dbgate-datalib": "^5.0.0-alpha.1",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-sqltree": "^5.0.0-alpha.1",
|
"dbgate-sqltree": "^5.0.0-alpha.1",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
|
|||||||
@@ -19,10 +19,14 @@ class ImportStream extends stream.Transform {
|
|||||||
try {
|
try {
|
||||||
if (chunk.specialMarker == 'copy_stdin_start') {
|
if (chunk.specialMarker == 'copy_stdin_start') {
|
||||||
this.writeQueryStream = await this.driver.writeQueryFromStream(this.dbhan, chunk.text);
|
this.writeQueryStream = await this.driver.writeQueryFromStream(this.dbhan, chunk.text);
|
||||||
} else if (chunk.specialMarker == 'copy_stdin_data') {
|
} else if (chunk.specialMarker == 'copy_stdin_line') {
|
||||||
this.writeQueryStream.write(chunk.text);
|
this.writeQueryStream.write(chunk.text);
|
||||||
} else if (chunk.specialMarker == 'copy_stdin_end') {
|
} else if (chunk.specialMarker == 'copy_stdin_end') {
|
||||||
this.writeQueryStream.end();
|
this.writeQueryStream.end();
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
this.writeQueryStream.on('finish', resolve);
|
||||||
|
this.writeQueryStream.on('error', reject);
|
||||||
|
});
|
||||||
this.writeQueryStream = null;
|
this.writeQueryStream = null;
|
||||||
} else {
|
} else {
|
||||||
await this.driver.script(this.dbhan, chunk.text, { queryOptions: { importSqlDump: true } });
|
await this.driver.script(this.dbhan, chunk.text, { queryOptions: { importSqlDump: true } });
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
"typescript": "^4.4.3"
|
"typescript": "^4.4.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-sqltree": "^5.0.0-alpha.1",
|
"dbgate-sqltree": "^5.0.0-alpha.1",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"json-stable-stringify": "^1.0.1",
|
"json-stable-stringify": "^1.0.1",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"chartjs-adapter-moment": "^1.0.0",
|
"chartjs-adapter-moment": "^1.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dbgate-datalib": "^5.0.0-alpha.1",
|
"dbgate-datalib": "^5.0.0-alpha.1",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-sqltree": "^5.0.0-alpha.1",
|
"dbgate-sqltree": "^5.0.0-alpha.1",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"dbgate-types": "^5.0.0-alpha.1",
|
"dbgate-types": "^5.0.0-alpha.1",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bson": "^6.8.0",
|
"bson": "^6.8.0",
|
||||||
"dbgate-plugin-tools": "^1.0.7",
|
"dbgate-plugin-tools": "^1.0.7",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"is-promise": "^4.0.0",
|
"is-promise": "^4.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async-lock": "^1.2.6",
|
"async-lock": "^1.2.6",
|
||||||
"dbgate-plugin-tools": "^1.0.7",
|
"dbgate-plugin-tools": "^1.0.7",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"tedious": "^18.2.0",
|
"tedious": "^18.2.0",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"antares-mysql-dumper": "^0.0.1",
|
"antares-mysql-dumper": "^0.0.1",
|
||||||
"dbgate-plugin-tools": "^1.0.7",
|
"dbgate-plugin-tools": "^1.0.7",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"mysql2": "^3.11.0",
|
"mysql2": "^3.11.0",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
const dbhan = {
|
const dbhan = {
|
||||||
client,
|
client,
|
||||||
database,
|
database,
|
||||||
}
|
};
|
||||||
if (isReadOnly) {
|
if (isReadOnly) {
|
||||||
await this.query(dbhan, 'SET SESSION TRANSACTION READ ONLY');
|
await this.query(dbhan, 'SET SESSION TRANSACTION READ ONLY');
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,11 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options?.importSqlDump && sql.trim().startsWith('/*!') && sql.includes('character_set_client')) {
|
if (
|
||||||
|
options?.importSqlDump &&
|
||||||
|
(sql.trim().startsWith('/*!') || sql.trim().startsWith('/*M!')) &&
|
||||||
|
(sql.includes('character_set_client') || sql.includes('NOTE_VERBOSITY'))
|
||||||
|
) {
|
||||||
// skip this in SQL dumps
|
// skip this in SQL dumps
|
||||||
return {
|
return {
|
||||||
rows: [],
|
rows: [],
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dbgate-plugin-tools": "^1.0.8",
|
"dbgate-plugin-tools": "^1.0.8",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dbgate-plugin-tools": "^1.0.7",
|
"dbgate-plugin-tools": "^1.0.7",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"pg": "^8.11.5",
|
"pg": "^8.11.5",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dbgate-plugin-tools": "^1.0.7",
|
"dbgate-plugin-tools": "^1.0.7",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dbgate-tools": "^5.0.0-alpha.1",
|
"dbgate-tools": "^5.0.0-alpha.1",
|
||||||
"dbgate-plugin-tools": "^1.0.4",
|
"dbgate-plugin-tools": "^1.0.4",
|
||||||
"dbgate-query-splitter": "^4.10.4",
|
"dbgate-query-splitter": "^4.10.5",
|
||||||
"byline": "^5.0.0",
|
"byline": "^5.0.0",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
|
|||||||
@@ -3224,10 +3224,10 @@ dbgate-plugin-xml@^5.0.0-alpha.1:
|
|||||||
resolved "https://registry.yarnpkg.com/dbgate-plugin-xml/-/dbgate-plugin-xml-5.2.7.tgz#0762af51ba6f100e75a63907ea6c679e827c9f7c"
|
resolved "https://registry.yarnpkg.com/dbgate-plugin-xml/-/dbgate-plugin-xml-5.2.7.tgz#0762af51ba6f100e75a63907ea6c679e827c9f7c"
|
||||||
integrity sha512-gBXy4qetf7eJQW6lM01B+OKLnKB8MKesojdYKysD9oZ+YpQCX8Tq7aHJCrN14FiyIDinpX61kmFH1+LGJ2RkxQ==
|
integrity sha512-gBXy4qetf7eJQW6lM01B+OKLnKB8MKesojdYKysD9oZ+YpQCX8Tq7aHJCrN14FiyIDinpX61kmFH1+LGJ2RkxQ==
|
||||||
|
|
||||||
dbgate-query-splitter@^4.10.4:
|
dbgate-query-splitter@^4.10.5:
|
||||||
version "4.10.4"
|
version "4.10.5"
|
||||||
resolved "https://registry.yarnpkg.com/dbgate-query-splitter/-/dbgate-query-splitter-4.10.4.tgz#38c7f98f6ce5a8c9cf34391d9f32490978bd978d"
|
resolved "https://registry.yarnpkg.com/dbgate-query-splitter/-/dbgate-query-splitter-4.10.5.tgz#bef9f2c2232b14aab6d3a0d490739ad216a1b45b"
|
||||||
integrity sha512-JVO0PSskF5dNnrYC8325HtEAxP3LhN1HQuKsOf4c+OXGocwWB3N7GPDc81cuyDTVCKb/oBHRE6akwAGKIyHkVA==
|
integrity sha512-AWcKcU3hbS8rAYrA52bwzdwtLv1llZgJ7Ut8AVPVWm5i38J4EdRFA2nMnx4Y5GLPqA1SRSUFsjBsNWWaHa/BAg==
|
||||||
|
|
||||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
|
debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
|
||||||
version "2.6.9"
|
version "2.6.9"
|
||||||
|
|||||||
Reference in New Issue
Block a user