-
Notifications
You must be signed in to change notification settings - Fork 34
/
db-oracle.js
39 lines (34 loc) · 1 KB
/
db-oracle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*!
* Copyright by Mariano Iglesias
*
* See license text in LICENSE file
*/
/**
* Require bindings native binary
*
* @ignore
*/
var EventEmitter = require('events').EventEmitter,
binding;
try {
binding = require("./build/default/oracle_bindings");
} catch(error) {
binding = require("./build/Release/oracle_bindings");
}
function extend(target, source) {
for (var k in source.prototype) {
target.prototype[k] = source.prototype[k];
}
return target;
}
var BaseEventEmitter = extend(function() {}, EventEmitter);
BaseEventEmitter.prototype.emit = function() {
var type = arguments[0];
if (type === 'error' && (!this._events || !this._events.error || (Array.isArray(this._events.error) && !this._events.error.length))) {
// Silently allow unattached error events
return;
}
return EventEmitter.prototype.emit.apply(this, arguments);
}
exports.Query = extend(binding.Query, BaseEventEmitter);
exports.Database = extend(binding.Oracle, BaseEventEmitter);