diff --git a/integration-tests/__tests__/alter-database.spec.js b/integration-tests/__tests__/alter-database.spec.js index 2863d9d97..490de76a9 100644 --- a/integration-tests/__tests__/alter-database.spec.js +++ b/integration-tests/__tests__/alter-database.spec.js @@ -11,7 +11,7 @@ const { runCommandOnDriver, } = require('dbgate-tools'); -const initSql = ['CREATE TABLE t1 (id int primary key)', 'CREATE TABLE t2 (id int primary key)']; +const initSql = ['CREATE TABLE ~t1 (~id int primary key)', 'CREATE TABLE ~t2 (~id int primary key)']; function flatSource(engineCond = x => !x.skipReferences) { return _.flatten( @@ -22,13 +22,14 @@ function flatSource(engineCond = x => !x.skipReferences) { } async function testDatabaseDiff(conn, driver, mangle, createObject = null) { - await driver.query(conn, `create table t1 (id int not null primary key)`); + await runCommandOnDriver(conn, driver, `create table ~t1 (~id int not null primary key)`); - await driver.query( + await runCommandOnDriver( conn, - `create table t2 ( - id int not null primary key, - t1_id int null references t1(id) + driver, + `create table ~t2 ( + ~id int not null primary key, + ~t1_id int null references ~t1(~id) )` ); @@ -78,7 +79,7 @@ describe('Alter database', () => { test.each(flatSource(x => x.supportRenameSqlObject))( 'Rename object - %s - %s', testWrapper(async (conn, driver, type, object, engine) => { - for (const sql of initSql) await driver.query(conn, sql, { discardResult: true }); + for (const sql of initSql) await runCommandOnDriver(conn, driver, sql); await runCommandOnDriver(conn, driver, object.create1); diff --git a/integration-tests/__tests__/object-analyse.spec.js b/integration-tests/__tests__/object-analyse.spec.js index e0577dc1b..f924f2137 100644 --- a/integration-tests/__tests__/object-analyse.spec.js +++ b/integration-tests/__tests__/object-analyse.spec.js @@ -87,7 +87,7 @@ describe('Object analyse', () => { const structure2 = await driver.analyseIncremental(conn, structure1); expect(structure2[type].length).toEqual(0); - await runCommandOnDriver(conn, driver, structure1[type][0].createSql); + await driver.script(conn, structure1[type][0].createSql); const structure3 = await driver.analyseIncremental(conn, structure2); diff --git a/integration-tests/engines.js b/integration-tests/engines.js index be09a4f43..7b0bc7364 100644 --- a/integration-tests/engines.js +++ b/integration-tests/engines.js @@ -427,20 +427,27 @@ end;$$`, drop1: 'DROP PROCEDURE ~obj1', drop2: 'DROP PROCEDURE ~obj2', }, + { + type: 'functions', + create1: 'CREATE FUNCTION ~obj1 RETURN NUMBER IS v_count NUMBER; \n BEGIN SELECT COUNT(*) INTO v_count FROM ~t1;\n RETURN v_count;\n END ~obj1', + create2: 'CREATE FUNCTION ~obj2 RETURN NUMBER IS v_count NUMBER; \n BEGIN SELECT COUNT(*) INTO v_count FROM ~t2;\n RETURN v_count;\n END ~obj2', + drop1: 'DROP FUNCTION ~obj1', + drop2: 'DROP FUNCTION ~obj2', + }, ], }, ]; const filterLocal = [ // filter local testing - '-MySQL', + 'MySQL', '-MariaDB', '-PostgreSQL', '-SQL Server', '-SQLite', '-CockroachDB', '-ClickHouse', - 'Oracle', + '-Oracle', ]; const enginesPostgre = engines.filter(x => x.label == 'PostgreSQL'); diff --git a/plugins/dbgate-plugin-oracle/src/backend/driver.js b/plugins/dbgate-plugin-oracle/src/backend/driver.js index 6506cc4e2..c85840fb3 100644 --- a/plugins/dbgate-plugin-oracle/src/backend/driver.js +++ b/plugins/dbgate-plugin-oracle/src/backend/driver.js @@ -107,7 +107,6 @@ const driver = { sql = mtrim[1]; } - // console.log('EXECUTE SQL:', sql); const res = await dbhan.client.execute(sql); try { const columns = extractOracleColumns(res.metaData);