knex/lib/dialects/oracle/formatter.js

30 lines
850 B
JavaScript
Raw Normal View History

var inherits = require('inherits')
var assign = require('lodash/object/assign')
var Formatter = require('../../formatter')
var ReturningHelper = require('./utils').ReturningHelper
function Oracle_Formatter(client) {
Formatter.call(this, client)
2014-08-11 12:25:39 +02: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
alias: function(first, second) {
return first + ' ' + second;
},
parameter: function(value, notSetValue) {
// returning helper uses always ROWID as string
if (value instanceof ReturningHelper && this.client.driver) {
value = this.client.driver.OutParam(this.client.driver.OCCISTRING)
}
if (typeof value === 'boolean') {
value = value ? 1 : 0
}
return Formatter.prototype.parameter.call(this, value, notSetValue)
2014-08-11 12:25:39 +02:00
}
})
2014-08-11 12:25:39 +02:00
module.exports = Oracle_Formatter