knex/lib/dialects/oracle/formatter.js

31 lines
875 B
JavaScript
Raw Normal View History

2015-04-22 15:39:29 -04:00
'use strict';
2015-05-09 13:58:18 -04:00
var inherits = require('inherits');
var assign = require('lodash/object/assign');
var Formatter = require('../../formatter');
var ReturningHelper = require('./utils').ReturningHelper;
function Oracle_Formatter(client) {
2015-05-09 13:58:18 -04:00
Formatter.call(this, client);
2014-08-11 12:25:39 +02:00
}
2015-05-09 13:58:18 -04:00
inherits(Oracle_Formatter, Formatter);
2014-08-11 12:25:39 +02:00
assign(Oracle_Formatter.prototype, {
2014-08-11 12:25:39 +02:00
2015-05-09 13:58:18 -04:00
alias: function alias(first, second) {
return first + ' ' + second;
},
2015-05-09 13:58:18 -04:00
parameter: function parameter(value, notSetValue) {
2015-04-27 20:22:05 -04:00
// Returning helper uses always ROWID as string
if (value instanceof ReturningHelper && this.client.driver) {
2015-05-09 13:58:18 -04:00
value = new this.client.driver.OutParam(this.client.driver.OCCISTRING);
} else if (typeof value === 'boolean') {
value = value ? 1 : 0;
}
2015-05-09 13:58:18 -04:00
return Formatter.prototype.parameter.call(this, value, notSetValue);
2014-08-11 12:25:39 +02:00
}
2015-05-09 13:58:18 -04:00
});
2014-08-11 12:25:39 +02:00
2015-05-09 13:58:18 -04:00
module.exports = Oracle_Formatter;