You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and this code results in the following node-mysql2 error
{
code: 'ER_PARSE_ERROR',
errno: 1064,
sql: '-- name: FindManyByAccountId :many\nSELECT\n account_transaction_id,\n account_id,\n point_saas_account_transaction_category_id,\n tenant_account_transaction_category_id,\n history_type,\n amount,\n expired_at,\n balance,\n title,\n content,\n created_at\nFROM\n account_transactions\nWHERE\n account_id = 1\nORDER BY\n created_at DESC\nLIMIT\n \'0\', \'20\'',
sqlState: '42000',
sqlMessage: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'\'20\', \'0\'\' at line 21'
}
So I think node-mysql2 does not respect supportBigNumbers and bigNumberStrings options here.
What I came up with is these two solution:
Somehow get which argument is used for which column/condition, and decide TypeScript type
also posted to node-mysql2: sidorares/node-mysql2#2551
As stated in the title(and the liked issue), node-mysql2 seems to always use number for limit and offset(and possibly some other cases).
And that does not work well with our current implementation.
sqlc-gen-typescript currently generates following code for the above query.
and this code results in the following node-mysql2 error
So I think node-mysql2 does not respect
supportBigNumbers
andbigNumberStrings
options here.What I came up with is these two solution:
support_big_numbers
#22 )string | number
and let users chose the typesupportBigNumbers
andbigNumberStrings
is false/unspecified, use number in that case.The text was updated successfully, but these errors were encountered: