mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fixed analyse of mysql procedures/functions
This commit is contained in:
parent
2ec962e2f1
commit
966307fd3c
4
packages/types/dbinfo.d.ts
vendored
4
packages/types/dbinfo.d.ts
vendored
@ -97,7 +97,9 @@ export interface ViewInfo extends SqlObjectInfo {
|
|||||||
|
|
||||||
export interface ProcedureInfo extends SqlObjectInfo {}
|
export interface ProcedureInfo extends SqlObjectInfo {}
|
||||||
|
|
||||||
export interface FunctionInfo extends SqlObjectInfo {}
|
export interface FunctionInfo extends SqlObjectInfo {
|
||||||
|
// returnDataType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TriggerInfo extends SqlObjectInfo {}
|
export interface TriggerInfo extends SqlObjectInfo {}
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
.map(fp.omit(['objectType']))
|
.map(fp.omit(['objectType']))
|
||||||
.map(x => ({
|
.map(x => ({
|
||||||
...x,
|
...x,
|
||||||
|
createSql: `DELIMITER //\n\nCREATE PROCEDURE \`${x.pureName}\`()\n${x.routineDefinition}\n\nDELIMITER ;\n`,
|
||||||
objectId: x.pureName,
|
objectId: x.pureName,
|
||||||
contentHash: _.isDate(x.modifyDate) ? x.modifyDate.toISOString() : x.modifyDate,
|
contentHash: _.isDate(x.modifyDate) ? x.modifyDate.toISOString() : x.modifyDate,
|
||||||
})),
|
})),
|
||||||
@ -140,6 +141,9 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
.map(fp.omit(['objectType']))
|
.map(fp.omit(['objectType']))
|
||||||
.map(x => ({
|
.map(x => ({
|
||||||
...x,
|
...x,
|
||||||
|
createSql: `CREATE FUNCTION \`${x.pureName}\`()\nRETURNS ${x.returnDataType} ${
|
||||||
|
x.isDeterministic == 'YES' ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'
|
||||||
|
}\n${x.routineDefinition}`,
|
||||||
objectId: x.pureName,
|
objectId: x.pureName,
|
||||||
contentHash: _.isDate(x.modifyDate) ? x.modifyDate.toISOString() : x.modifyDate,
|
contentHash: _.isDate(x.modifyDate) ? x.modifyDate.toISOString() : x.modifyDate,
|
||||||
})),
|
})),
|
||||||
|
@ -3,7 +3,9 @@ select
|
|||||||
ROUTINE_NAME as pureName,
|
ROUTINE_NAME as pureName,
|
||||||
ROUTINE_TYPE as objectType,
|
ROUTINE_TYPE as objectType,
|
||||||
COALESCE(LAST_ALTERED, CREATED) as modifyDate,
|
COALESCE(LAST_ALTERED, CREATED) as modifyDate,
|
||||||
ROUTINE_DEFINITION as createSql
|
DATA_TYPE AS returnDataType,
|
||||||
|
ROUTINE_DEFINITION as routineDefinition,
|
||||||
|
IS_DETERMINISTIC as isDeterministic
|
||||||
from information_schema.routines
|
from information_schema.routines
|
||||||
where ROUTINE_SCHEMA = '#DATABASE#' and ROUTINE_NAME =OBJECT_ID_CONDITION
|
where ROUTINE_SCHEMA = '#DATABASE#' and ROUTINE_NAME =OBJECT_ID_CONDITION
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user