on ‎2021 Apr 15 9:20 AM
Hi All,
I am new to cloud application programming and facing a strange issue.
I have table in Hana container which have field "Key" with type VARBINARY(16). Now I am trying to read the record from this table in my MTA application using normal read. I need to pass this Key to another select query.
When I am getting this record in console the Key field showing value like <Buffer 00 50 56 ac 42> and then I am trying to pass this value to another Select query I am getting error "Error: Cannot build SELECT.columns()".
As per me, I need to convert this key value in to normal string before passing to new Select query.
Is anyone faced such issue or How to convert the value to pass it to another Select query ?
Request clarification before answering.
I got the solution, The entity is returning buffer object and as David mentioned NodeJs Buffer can be convert to String using toString(). I tried was trying it earlier but it was not giving me right conversion. But then I found different encodings which are :
'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
Out of these correct encoding which helped me is 'hex'. So the final conversion which I used is as below :
data.toString('hex');
So that's the simple solution 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.