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
Collation and charset #62
Comments
|
My apologies, originally stated that my MariaDB/Sequelize connection settings matched your description, which is incorrect. Currently using charset: utf8mb4 instead of UTF8MB4_GENERAL_CI Using Sequelize/ORM and this driver to interface with MariaDB. Assuming that Sequelize does extra work behind the scenes, which could prevent error logging to my console. @rusher - any thoughts? My MariaDB/Sequelize Connection Code for Reference |
|
Your It does not work for me with both: |
|
This works for me as I do not see the error message you mentioned. Can you post your full Sequelize connection code as well? |
|
Alright, there is really an issue there, because actual implementation accepts only collation name (like 'UTF8MB4_GENERAL_CI'). |
|
@rusher - you are absolutely right. This now works without defining either charset or collate, as shown below... |
|
@ccinelli - close issue? |
|
done with commit: 5eb3847 |
|
Are you sure it will be backward compatible? Otherwise it should be in 3.0.0 assuming you use semver |
|
Can you please take a second look at the code? Let me add some context: I had the usual problem of trying to store emojis in a table that was using the default So I was trying to set a default in the In SQL you usually use: My understanding is that a So my first attempt was to specify both in But I had an error. Then I looked at the code and realized that in order to make it work I had to use: That seemed wrong since that is a collation and I reported this issue. How it should beI thought that you should be able to specify both If you specify only If you specify only How it works in the
|
|
@ccinelli here is the new implementation: The option The option For compatibility, it's still possible to indicate a collation using the I'm still hesitant about multiplying options, but And since you've asked, that means this need better documentation, I'll see to that now. |
This code here is a little weird:
https://github.com/MariaDB/mariadb-connector-nodejs/blob/3eeba5ee1c4e9d7549aa857316db679c6af159a6/lib/config/connection-options.js#L28-L35 and it seems to mix up collation and charset.
Using
charset: 'utf8mb4'throws and error. Addingcollation: 'UTF8MB4_GENERAL_CI'also throw an error.In order to work you need to use
charset: 'UTF8MB4_GENERAL_CI'Finally it looks like that if you pass
charsetNumber: 12345678you will get aCollations.fromIndex(224); //UTF8MB4_UNICODE_CIIn my humble opinion
charset: 'utf8mb4' should work and usecollation: 'UTF8MB4_GENERAL_CI'as default. Also collations should be specified withcollation:, nocharset`.The text was updated successfully, but these errors were encountered: