GH-2915 Oracledb tests are failing (#2924)

* GH-2915 Oracledb tests are failing

- fixes oracledb failing tests

* Fixes oracledb increment() and decrement() empty query

- Error: The query is empty

* Add ToDo for fixing Oracle bug
This commit is contained in:
Randy Garces 2018-11-23 19:58:23 +08:00 committed by Igor Savin
parent 33bb7710b8
commit ab35e97614
3 changed files with 15 additions and 7 deletions

View File

@ -284,7 +284,7 @@ _.assign(Oracledb_Compiler.prototype, {
const self = this; const self = this;
const sql = {}; const sql = {};
const outBindPrep = this._prepOutbindings( const outBindPrep = this._prepOutbindings(
this.single.update, this.single.update || this.single.counter,
this.single.returning this.single.returning
); );
const outBinding = outBindPrep.outBinding; const outBinding = outBindPrep.outBinding;
@ -297,7 +297,7 @@ _.assign(Oracledb_Compiler.prototype, {
let intoClause = ''; let intoClause = '';
if ( if (
_.isEmpty(this.single.update) && _.isEmpty(updates) &&
typeof this.single.update !== 'function' typeof this.single.update !== 'function'
) { ) {
return ''; return '';

View File

@ -87,7 +87,9 @@ module.exports = function(knex) {
return knex('accounts') return knex('accounts')
.select('*') .select('*')
.where('id', '=', 1) .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() { it('handles unions with an array raw queries', function() {
@ -95,8 +97,8 @@ module.exports = function(knex) {
.select('*') .select('*')
.where('id', '=', 1) .where('id', '=', 1)
.union([ .union([
knex.raw('select * from accounts where id = ?', [2]), knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 2]),
knex.raw('select * from accounts where id = ?', [3]), knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 3]),
]); ]);
}); });
@ -105,8 +107,8 @@ module.exports = function(knex) {
.select('*') .select('*')
.where('id', '=', 1) .where('id', '=', 1)
.union( .union(
knex.raw('select * from accounts where id = ?', [2]), knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 2]),
knex.raw('select * from accounts where id = ?', [3]) knex.raw('select * from ?? where ?? = ?', ['accounts', 'id', 3])
); );
}); });
}); });

View File

@ -192,6 +192,12 @@ module.exports = function(knex) {
'fileName', 'fileName',
'20150109002832_invalid_migration.js' '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 });
}); });
}); });