Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
furicle opened this issue Jan 2, 2024 · 2 comments
Labels

Comments

@furicle
Copy link

furicle commented Jan 2, 2024

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
Copy link
Member

MasterOdin commented Jan 2, 2024

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?

@MasterOdin MasterOdin added the bug label Jan 2, 2024
@furicle
Copy link
Author

furicle commented Jan 4, 2024

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

mysql-5.1.73-8.el6_8.x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants