问题
I'm new at firebird. I am trying to fetch the name from DB, but it returns:
<Buffer d2 f3 f0 e0 e5 e2 e0 20>
What does it mean? How to convert it to readable characters? Thanks in advance
db.query('SELECT FIRST 10 * FROM client', function(err, result) {
// IMPORTANT: close the connection
console.log(result[0].name)
db.detach();
});
回答1:
It is a Buffer object (NodeJS docu), which is the usual return value for data, whose type is not predetermined.
To convert it to a string again, use its toString() method with a given encoding, e.g.:
var name = result[0].name.toString( 'utf8' );
来源:https://stackoverflow.com/questions/29672531/unknown-value-buffer-d2-f3-f0-e0-e5-e2-e0-20-when-select-from-firebird-in-node