Closed souris-dev closed 3 years ago
You are missing new line at end of many files. Please add that.
@krishnadey30 Thanks for reviewing my PR! I've made the recommended changes and addressed the comments, please do have a look whenever you have the time. @ben-albrecht @marcoscleison @buddha314 Would love feedback/comments so do have a look whenever time permits :-). Thanks!
@ben-albrecht Thanks for the review! I've addressed the comments and made the suggested changes, do have a look when possible. (I've also changed the indentation to 2 spaces for convention.)
Thanks for the reviews! I've made the changes suggested by @krishnadey30 and made the PR ready to be merged.
The existing code for the MySQL implementation lacked certain features and could use a revamp, so I took my liberty and refactored it while adding a couple of new things to it.
Here is a short non-extensive synopsis of the changes you should find:
Added support for TOML configuration files that can be loaded and used for reading the connection parameters, to make it easier to checkout the code to version control and/or deploy the code without revealing critical database info or keys. (The
ConnectionHandlerWithConfig
procedure helps with this.)There is a new
Statement
class that allows building statements and makes the code look more elegant, in my opinion.There is now a
ConnectionHandler
class for more abstraction, which lets the user use different DBMSs by making very less changes in the code.There are interface-type classes that can be implemented to make an API for other relational databases. This can be useful while implementing the API for PostgreSQL and SQLite.
The module and submodules have been organized to include relevant classes.
MySQL feature additions: There are a number of functions that have been added to provide more control over the data returned (like for finding field type information etc.), and in case of errors in execution of the queries, meaningful output of the error from the DB engine is produced. (There are other features that have been added too, please have a look at the changes for details.)
Added tests (more could be added) for the above features, for the MySQL implementation and for other relevant parts too.
The tests can be run using
mason test
, but please ensure that theTestDBInit.chpl
file is compiled (usingmake test_db_init
) and executed first before the tests are run as this file initializes the database tables for the tests, and that the database credentials/details are also updated in the tests. Alternatively, you can also use theruntests.sh
script to run the tests (if this script is used, it ensures that the above step of compiling and executingTestDBInit.chpl
is performed before running the tests).I'd really appreciate feedback on the above and any other suggestions, and I hope that this PR could help in making this library even more useful.
Thanks!