提交 f9dd3a97 编写于 作者: Z zyyang

change

上级 c5cc4933
...@@ -367,12 +367,16 @@ CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) { ...@@ -367,12 +367,16 @@ CTaosInterface.prototype.fetchBlock = function fetchBlock(result, fields) {
let offset = 0; let offset = 0;
for (let i = 0; i < fields.length; i++) { for (let i = 0; i < fields.length; i++) {
pdata = ref.reinterpret(pblock,8,i*8); pdata = ref.reinterpret(pblock,8,i*8);
if(ref.isNull(pdata.readPointer())){
blocks[i] = new Array();
}else{
pdata = ref.ref(pdata.readPointer()); pdata = ref.ref(pdata.readPointer());
if (!convertFunctions[fields[i]['type']] ) { if (!convertFunctions[fields[i]['type']] ) {
throw new errors.DatabaseError("Invalid data type returned from database"); throw new errors.DatabaseError("Invalid data type returned from database");
} }
blocks[i] = convertFunctions[fields[i]['type']](pdata, 1, fieldlens[i], offset, isMicro); blocks[i] = convertFunctions[fields[i]['type']](pdata, 1, fieldlens[i], offset, isMicro);
} }
}
return {blocks: blocks, num_of_rows:Math.abs(num_of_rows)} return {blocks: blocks, num_of_rows:Math.abs(num_of_rows)}
} }
CTaosInterface.prototype.fetchRow = function fetchRow(result, fields) { CTaosInterface.prototype.fetchRow = function fetchRow(result, fields) {
...@@ -437,6 +441,9 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback, ...@@ -437,6 +441,9 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback,
} }
if (numOfRows2 > 0){ if (numOfRows2 > 0){
for (let i = 0; i < fields.length; i++) { for (let i = 0; i < fields.length; i++) {
if(ref.isNull(pdata.readPointer())){
blocks[i] = new Array();
}else{
if (!convertFunctions[fields[i]['type']] ) { if (!convertFunctions[fields[i]['type']] ) {
throw new errors.DatabaseError("Invalid data type returned from database"); throw new errors.DatabaseError("Invalid data type returned from database");
} }
...@@ -447,6 +454,7 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback, ...@@ -447,6 +454,7 @@ CTaosInterface.prototype.fetch_rows_a = function fetch_rows_a(result, callback,
//offset += fields[i]['bytes'] * numOfRows2; //offset += fields[i]['bytes'] * numOfRows2;
} }
} }
}
callback(param2, result2, numOfRows2, blocks); callback(param2, result2, numOfRows2, blocks);
} }
asyncCallbackWrapper = ffi.Callback(ref.types.void, [ ref.types.void_ptr, ref.types.void_ptr, ref.types.int ], asyncCallbackWrapper); asyncCallbackWrapper = ffi.Callback(ref.types.void, [ ref.types.void_ptr, ref.types.void_ptr, ref.types.int ], asyncCallbackWrapper);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册