diff --git a/src/dialects/oracledb/query/compiler.js b/src/dialects/oracledb/query/compiler.js index c0bb70b04..6ec1b4197 100644 --- a/src/dialects/oracledb/query/compiler.js +++ b/src/dialects/oracledb/query/compiler.js @@ -284,7 +284,7 @@ _.assign(Oracledb_Compiler.prototype, { const self = this; const sql = {}; const outBindPrep = this._prepOutbindings( - this.single.update, + this.single.update || this.single.counter, this.single.returning ); const outBinding = outBindPrep.outBinding; @@ -297,7 +297,7 @@ _.assign(Oracledb_Compiler.prototype, { let intoClause = ''; if ( - _.isEmpty(this.single.update) && + _.isEmpty(updates) && typeof this.single.update !== 'function' ) { return ''; diff --git a/test/integration/builder/unions.js b/test/integration/builder/unions.js index c80732f00..97f560ac0 100644 --- a/test/integration/builder/unions.js +++ b/test/integration/builder/unions.js @@ -87,7 +87,9 @@ module.exports = function(knex) { return knex('accounts') .select('*') .where('id', '=', 1) - .union(knex.raw('select * from accounts where id = ?', [2])); + .union( + knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 2]) + ); }); it('handles unions with an array raw queries', function() { @@ -95,8 +97,8 @@ module.exports = function(knex) { .select('*') .where('id', '=', 1) .union([ - knex.raw('select * from accounts where id = ?', [2]), - knex.raw('select * from accounts where id = ?', [3]), + knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 2]), + knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 3]), ]); }); @@ -105,8 +107,8 @@ module.exports = function(knex) { .select('*') .where('id', '=', 1) .union( - knex.raw('select * from accounts where id = ?', [2]), - knex.raw('select * from accounts where id = ?', [3]) + knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 2]), + knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 3]) ); }); }); diff --git a/test/integration/migrate/index.js b/test/integration/migrate/index.js index 66cbeec80..5e149040b 100644 --- a/test/integration/migrate/index.js +++ b/test/integration/migrate/index.js @@ -192,6 +192,12 @@ module.exports = function(knex) { 'fileName', '20150109002832_invalid_migration.js' ); + }) + .then(function(data) { + // Clean up lock for other tests + // TODO: Remove this code to reproduce https://github.com/tgriesser/knex/issues/2925 + // It is only relevant for Oracle, most likely there is a bug somewhere that needs fixing + return knex('knex_migrations_lock').update({ is_locked: 0 }); }); });