chore: using mysql2 as library for serverless-mysql#374
chore: using mysql2 as library for serverless-mysql#374andreabadesso wants to merge 1 commit intomasterfrom
Conversation
| `SELECT \`tx_id\`, | ||
| \`token_id\`, | ||
| SUM(\`balance\`) AS balance, | ||
| CAST(SUM(\`balance\`) AS INTEGER) AS balance, |
There was a problem hiding this comment.
mysql2 is returning SUM, MIN and MAX as strings, so we can either cast it on mysql itself or on javascript, with parseInt, I prefer doing it directly in mysql
There was a problem hiding this comment.
Casting to integer is fine but the SUM returns a DECIMAL (which the client converts to a string) because of a posible overflow and precision issues. Maybe we should check no cast has this problem, like a sum of output values that can go over the mysql native integer highest number.
cf8543e to
84d84e6
Compare
| "": { | ||
| "name": "hathor-wallet-service", | ||
| "version": "1.23.0-beta", | ||
| "version": "1.23.1-beta", |
There was a problem hiding this comment.
The last bump didn't update this, totally unrelated to the PR
| `SELECT \`tx_id\`, | ||
| \`token_id\`, | ||
| SUM(\`balance\`) AS balance, | ||
| CAST(SUM(\`balance\`) AS INTEGER) AS balance, |
There was a problem hiding this comment.
Casting to integer is fine but the SUM returns a DECIMAL (which the client converts to a string) because of a posible overflow and precision issues. Maybe we should check no cast has this problem, like a sum of output values that can go over the mysql native integer highest number.
Motivation
The last update of the
mysqllibrary we were using was in Jan 23, 2020Acceptance Criteria
mysql2as the library for serverless-mysql (mysql is the default)Security Checklist