mongodb / mongo-jdbc-driver

JDBC Driver for MongoDB Atlas SQL interface
Apache License 2.0
37 stars 33 forks source link

SQL-602: Refactor shared BSON information into single class #65

Closed mattChiaravalloti closed 2 years ago

mattChiaravalloti commented 2 years ago

This PR creates the BsonTypeInfo enum (as proposed here) and replaces all references to BSON information (such as type names, precisions, scales, etc) with references to variants of this new enum as a single source of information.

Note I did not implement the suggestion of using a flag to indicate whether the context is MongoSQL or MySQL. The refactor primarily focused on updating the MongoSQL* classes. The MySQL classes were updated but only to use the bson type names from the enum. Let me know if you think it is worth extending this further to fully update the MySQL classes as well. I'm not sure that would be worth the effort for a minimal win since, as I often come back to, the MySQL dialect will not be around in this iteration of the driver for long.

mattChiaravalloti commented 2 years ago

This is ready for another look. Note that some BSON_BSON-related comments resulted in no code changes, only new code comments! See the relevant threads on this PR for details.