Strings are converted to the data type of buffer
See original GitHub issueHello! I have the following table:
CREATE TABLE GROUP_ORDER (
ID INTEGER NOT NULL,
SOURCE_ID INTEGER NOT NULL,
NUMBER VARCHAR(200) NOT NULL,
IS_OPTIMIZED INTEGER NOT NULL,
"DATE" TIMESTAMP NOT NULL,
NUMBER_ORDER_LIST VARCHAR(5000)
);
I make this request:
select * from GROUP_ORDER
And I get this answer:
[ { ID: 2,
SOURCE_ID: 5,
NUMBER: <Buffer 31>,
IS_OPTIMIZED: 0,
DATE: 2017-01-16T22:00:00.000Z,
NUMBER_ORDER_LIST: <Buffer 30 32 36 33 31 5f 30 32 36 31 34> },
{ ID: 534,
SOURCE_ID: 3,
NUMBER: <Buffer 33>,
IS_OPTIMIZED: 1,
DATE: 2016-04-19T22:00:00.000Z,
NUMBER_ORDER_LIST: <Buffer 31 36> },
{ ID: 539,
SOURCE_ID: 9,
NUMBER: <Buffer 42 49 47 5f 31>,
IS_OPTIMIZED: 1,
DATE: 2016-05-21T22:00:00.000Z,
NUMBER_ORDER_LIST: <Buffer 31 2c 20 32 2c 20 33> },
{ ID: 540,
SOURCE_ID: 10,
NUMBER: <Buffer 42 49 47 5f 32>,
IS_OPTIMIZED: 1,
DATE: 2016-05-21T22:00:00.000Z,
NUMBER_ORDER_LIST: <Buffer 31 32 33 2c 20 35 2c 20 36> } ]
Why, instead Strings Variables I have variables of type Buffer (see fields NUMBER and NUMBER_ORDER_LIST)?
On database this one in the form of a buffer to another as a string.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:16 (1 by maintainers)
Top Results From Across the Web
How to convert a String to Buffer and vice versa in Node.js
To convert a string to a Buffer, you can use the from() method from the global Buffer class in Node.js. // a string...
Read more >Using the Buffer `toString()` Function in Node.js - Mastering JS
Node.js buffers are objects that store arbitrary binary data. Buffers have a toString() method that you can use to convert the buffer to...
Read more >Convert Node.js Buffer to String: An Easy-To-Follow Guide
In a nutshell, it's easy to convert a Buffer object to a string using the toString() method. You'll usually want the default UTF-8...
Read more >Converting a Buffer to JSON and Utf8 Strings in Nodejs
Buffers can convert to JSON. The JSON specifies that the type of object being transformed is a Buffer , and its data.
Read more >Converting between strings and ArrayBuffers - Stack Overflow
If the data is a string. If it is UTF16 or a smaller encoding, it can be turned into an ArrayBuffer with this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello, I have used this solution in order to decode buffer objects:
Here is an example of code illustrating how to print to the console the string encoded in the buffer:
use:
select ID, SOURCE_ID, cast(NUMBER as varchar(50) character set utf8) "NUMBER", IS_OPTIMIZED, DATE, cast(NUMBER_ORDER_LIST as varchar(50) character set utf8) "NUMBER_ORDER_LIST" from GROUP_ORDER