sqlectron / sqlectron-gui

A simple and lightweight SQL client desktop with cross database and platform support.
https://sqlectron.github.io/
MIT License
4.55k stars 522 forks source link

Select statement returns unexpected results - not sure what's happening here... #729

Open furicle opened 9 months ago

furicle commented 9 months ago

sqlectron 1.38.0 Windows 10 Pro 64 bit Interacting with an older MySQL server

If I run this query in sqlectron, I get odd results. select concat_ws("-",year(curdate())-2,"12","31");

sqlectron shows 50,48,50,52,45,49,50,45,51,49

2024-01-02_14-40-03

Running the same query from a terminal on the mysql server...

mysql> select concat_ws("-",year(curdate())-2,"12","31");
+--------------------------------------------+
| concat_ws("-",year(curdate())-2,"12","31") |
+--------------------------------------------+
| 2022-12-31                                 |
+--------------------------------------------+
1 row in set (0.00 sec)
MasterOdin commented 9 months ago

The value that's being shown is a naive string representation of a Buffer object. If you were to do:

> a = Buffer.from([50, 48, 50, 52, 45, 49, 50, 45, 51, 49])
<Buffer 32 30 32 34 2d 31 32 2d 33 31>
> a.toString()
'2024-12-31'

Can see that the value within the buffer is as you'd expect, it's just now a matter of figuring out why it's being returned as a buffer, as well as figuring out best way to get it to the appropriate string type before displaying it to the user.

What version of MySQL are you using?

furicle commented 9 months ago

Let me see - that one was (don't laugh)

mysql-5.1.73-8.el6_8.x86_64