@sap/hana-client
Advanced tools
Comparing version 2.5.86 to 2.5.101
# Hana Client 2.5.x Drivers | ||
## Version 2.5.101 | ||
Please see SAP Note 2937532 - SAP HANA Client 2.5 Release Notes | ||
https://launchpad.support.sap.com/#/notes/2937532 | ||
## Version 2.5.86 | ||
@@ -4,0 +10,0 @@ |
@@ -182,12 +182,25 @@ 'use strict'; | ||
function HanaParameterLobStream(statement, paramIndex, options) { | ||
checkParameter('statement', statement) | ||
checkParameter('statement', statement); | ||
Readable.call(this, { objectMode: true }); | ||
this.statement = statement; | ||
this.paramInfo = this.statement.getParameterInfo(); | ||
this.paramIndex = paramIndex; | ||
this.options = options || { readSize: DEFAULT_READ_SIZE }; | ||
this.readSize = (this.options.readSize > MAX_READ_SIZE) ? MAX_READ_SIZE : this.options.readSize; | ||
this.offset = 0; | ||
checkParameterIndex(this.paramInfo, paramIndex); | ||
checkParameterLobType(this.paramInfo, paramIndex); | ||
this.isString = this.paramInfo[this.paramIndex].typeName === 'STRING'; | ||
this.offset = 0; | ||
this.readSize = DEFAULT_READ_SIZE; | ||
this.valueAsString = false; | ||
if (options) { | ||
if (isInteger(options.readSize) && options.readSize > 0) { | ||
this.readSize = options.readSize; | ||
} | ||
if (typeof options.valueAsString === "boolean") { | ||
this.valueAsString = options.valueAsString; | ||
} | ||
} | ||
}; | ||
@@ -199,20 +212,46 @@ | ||
var stream = this; | ||
var buffer = createBuffer(this.readSize); | ||
var bufferSize = this.isString ? (this.readSize + 1) * 4 : this.readSize; | ||
var buffer = createBuffer(bufferSize); | ||
this.pause(); | ||
this.statement.getData(this.paramIndex, this.offset, buffer, 0, this.readSize, function (err, bytesRetrieved) { | ||
if (err === undefined) { | ||
stream.offset += bytesRetrieved; | ||
if (bytesRetrieved > 0) { | ||
if (bytesRetrieved < stream.readSize) { | ||
var buffer2 = createBuffer(bytesRetrieved); | ||
buffer.copy(buffer2, 0, 0, bytesRetrieved); | ||
stream.push(buffer2); | ||
if (stream.isString) { // For CLOB/NCLOB, bytesRetrieved is number of characters. | ||
if (bytesRetrieved > 0) { | ||
let firstNullChar = buffer.indexOf(0); | ||
let newBuffer = createBuffer(firstNullChar); | ||
buffer.copy(newBuffer, 0, 0, firstNullChar); | ||
if (stream.valueAsString) { | ||
stream.push(newBuffer.toString('utf8')); | ||
} else { | ||
stream.push(newBuffer); | ||
} | ||
if (bytesRetrieved < stream.readSize) { | ||
stream.push(null); | ||
} | ||
} else { | ||
stream.push(buffer); | ||
stream.push(null); | ||
} | ||
} else { // LOB | ||
if (bytesRetrieved > 0) { | ||
if (bytesRetrieved < stream.readSize) { | ||
var buffer2 = createBuffer(bytesRetrieved); | ||
buffer.copy(buffer2, 0, 0, bytesRetrieved); | ||
stream.push(buffer2); | ||
stream.push(null); | ||
} else { | ||
stream.push(buffer); | ||
} | ||
} else { | ||
stream.push(null); | ||
} | ||
} | ||
} else { | ||
if (err.code === 100) { // No more result | ||
stream.push(null); | ||
} else { | ||
stream.push(null); | ||
stream.emit('error', err); | ||
} | ||
} else { | ||
stream.emit('error', err); | ||
} | ||
stream.resume(); | ||
}); | ||
@@ -473,9 +512,27 @@ }; | ||
var paramInfo = hanaStmt.stmt.getParameterInfo(); | ||
var paramCount = 0; | ||
for (var i = 0; i < paramInfo.length; i++) { | ||
if (paramInfo[i].direction === 2 || paramInfo[i].direction === 3) { | ||
hanaStmt.hasScalarParams = true; | ||
hanaStmt.scalarParams[paramInfo[i].name] = hanaStmt.stmt.getParameterValue(i); | ||
hanaStmt.stmt.getParameterValue(i, (function() { | ||
var index = i; | ||
return function(err, val) { | ||
if(err) { | ||
hanaStmt.callback(err); | ||
} else { | ||
++paramCount; | ||
hanaStmt.scalarParams[paramInfo[index].name] = val; | ||
if (paramCount === paramInfo.length) { | ||
return hanaStmt.fetchTableParam(); | ||
} | ||
} | ||
}; | ||
})() ); | ||
} else { | ||
++paramCount; | ||
} | ||
} | ||
hanaStmt.fetchTableParam(); | ||
if (paramCount === paramInfo.length) { | ||
hanaStmt.fetchTableParam(); | ||
} | ||
} | ||
@@ -610,3 +667,11 @@ }); | ||
function isInteger(value) { | ||
if (typeof value === 'number' && value % 1 === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
var MAX_READ_SIZE = Math.pow(2, 18); | ||
var DEFAULT_READ_SIZE = Math.pow(2, 11) * 100; |
@@ -15,3 +15,3 @@ { | ||
}, | ||
"version": "2.5.86", | ||
"version": "2.5.101", | ||
"requires": true, | ||
@@ -18,0 +18,0 @@ "name": "@sap/hana-client", |
@@ -5,3 +5,3 @@ { | ||
"description": "Official SAP HANA Node.js Driver", | ||
"version": "2.5.86", | ||
"version": "2.5.101", | ||
"dependencies": { | ||
@@ -8,0 +8,0 @@ "debug": "3.1.0" |
# @sap/hana-client | ||
This is the official Node.js driver for [SAP HANA](http://go.sap.com/product/technology-platform/hana.html). It is used to connect, issue SQL queries, and obtain result sets. | ||
Fully-featured Node.js driver for [SAP HANA](https://www.sap.com/products/hana.html). It is used to connect, issue SQL queries, and obtain result sets. | ||
@@ -19,2 +19,9 @@ ## Install | ||
## Community | ||
SAP Community provides a forum where you can ask and answer questions, and | ||
comment and vote on the questions of others and their answers. | ||
See [SAP HANA Community Questions](https://answers.sap.com/tags/73554900100700000996) for details. | ||
## Help Guide | ||
@@ -21,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176398421
930
227