Skip to content

Commit

Permalink
add node-oracledb support (#990)
Browse files Browse the repository at this point in the history
* add node-oracledb support

* move file in src directory

* remove unused var

* correct pool release
correct date error

* correct bugs

* add some test

* correct a test error

* correct time zone error in schema tests

* correct time zone error in schema tests

* use inheritance to remove duplicated code

* use inherit in formatter to remove dupplicated code

* remove unused code

* remove unused require

* add blob insert support

* add queryCompiler to dialect prototype

* export queryCompiler

* fix bugs

* Correct tests

* handle returning

* clean code

* clean code

* Fix returning

* Multiple insert with blob

* Add SELECT BLOB support

* Finalise update

* Fix test error

* Fix insert error without returning

* Add transaction and code cleaning

* build

* Fix pool ping error

* Add missing rejecter

* build

* Fix error in delete

* Fix transaction rollback error throwing

* Fix typo in commit

* Fix rollback rejecter

* Remove BLOB tests

* remove lib file

* fixed oracledb linter errors

* Add .completed to transaction acquireConnection()
  • Loading branch information
atiertant authored and elhigu committed Jun 20, 2016
1 parent d113795 commit 53d089b
Show file tree
Hide file tree
Showing 11 changed files with 1,441 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -95,7 +95,8 @@
"pg-query-stream": false,
"oracle": false,
"strong-oracle": false,
"sqlite3": false
"sqlite3": false,
"oracledb": false
},
"files": [
"README.md",
Expand Down
5 changes: 3 additions & 2 deletions src/dialects/oracle/index.js
Expand Up @@ -130,7 +130,8 @@ assign(Client_Oracle.prototype, {
return connection.executeAsync(obj.returningSql, rowIds)
}).then(function(response) {
obj.response = response;
return obj
obj.rowsAffected = response.updateCount;
return obj;
})

},
Expand Down Expand Up @@ -158,7 +159,7 @@ assign(Client_Oracle.prototype, {
// return an array with values if only one returning value was specified
return flatten(map(response, values));
}
return response.updateCount;
return obj.rowsAffected;
default:
return response;
}
Expand Down
27 changes: 27 additions & 0 deletions src/dialects/oracledb/formatter.js
@@ -0,0 +1,27 @@
const inherits = require('inherits');
const Oracle_Formatter = require('../oracle/formatter');
const BlobHelper = require('./utils').BlobHelper;

import {assign} from 'lodash';

function Oracledb_Formatter(client) {
Oracle_Formatter.call(this, client);
}
inherits(Oracledb_Formatter, Oracle_Formatter);

assign(Oracledb_Formatter.prototype, {

// Checks whether a value is a function... if it is, we compile it
// otherwise we check whether it's a raw
parameter: function parameter(value) {
if (typeof value === 'function') {
return this.outputQuery(this.compileCallback(value), true);
} else if (value instanceof BlobHelper) {
return 'EMPTY_BLOB()';
}
return this.unwrapRaw(value, true) || '?';
}

});

module.exports = Oracledb_Formatter;

0 comments on commit 53d089b

Please sign in to comment.