-
Notifications
You must be signed in to change notification settings - Fork 10
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
Sadu Queries 2 #42
Sadu Queries 2 #42
Conversation
ec9d6d6
to
79b39e5
Compare
d4bbae4
to
1199f82
Compare
The update removes unused methods from the AppendedQuery class and updates the remaining query method to directly call ParsedQuery's static create method. This increases readability and reduces unnecessary complexity in the class.
Added a new class, AutoMappedQuery, to handle SQL queries and responses using the RowMapperRegistry. This change improves the system's ability to map query results to specific classes, increasing versatility and maintainability for complex SQL operations.
Updated the dependency from `sadu-queries` to `sadu-core` in the build.gradle.kts file. Also removed the QueryBuilderConfig and relevant methods from the BaseSqlUpdaterBuilder.java. These adjustments simplify the code base and reduce unnecessary complexities.
In the RowMapper class, the RowMapping interface is now implemented. A 'map' method, which maps rows and handles SQL exceptions, has been added to improve the robustness of the application and the management of potential errors. The refactoring also aided in maintaining clean and efficient code structure.
The UUIDAdapter class is made final and a private constructor is implemented to prevent creating an instance of this class. This alteration makes sure that UUIDAdapter serves purely as a utility class.
Created QueryConfiguration, ConnectedQueryConfiguration, and QueryConfigurationBuilder classes for better management and execution of SQL queries. These classes improve error handling, allow configuration for atomic query execution, and help in managing connection state efficiently. This addition enhances query execution process, providing cleaner and more flexible code structure.
The SqlUpdater class has been refactored. Hierarchical inheritance from QueryFactory has been removed, which led to some method parameters (source, config) being adjusted. The removal of unused imports and the cleanup contribute to a more streamlined and neater code base.
Added a new PostgresDatabase class with 'createContainer' method for spinning up PostgreSQL test containers. Refactored the test classes to ensure usage of these containers for testing, improving isolation and reliability of test cases. The 'afterAll' method is also added to ensure containers are properly closed after tests.
Refactored the variable name 'nc' to 'newCall' in 'single' method of 'Calls' class for enhanced readability. This should make the code easier to understand and maintain, by giving a more descriptive name to the variable. This does not
Two new exception classes, 'WrappedQueryExecutionException' and 'QueryExecutionException', were added in the 'de.chojo.sadu.queries.exception' package. These exceptions are designed to handle issues that may arise during the execution of queries. They wrap typical SQL exceptions as runtime exceptions, which simplifies error handling.
The Query class has been modified to utilize QueryConfiguration instead of DataSource. This change also involved replacing previous query() methods with error-handling ones, including exception logging. Furthermore, the connection() method has been over
This commit modifies ParsedQuery class in de.chojo.sadu.queries.stages package. This refactor includes changing some import statements for better clarity, adjusting the access modifier of a constructor for increased encapsulation, and the addition of a new static creation method to enhance error management.
The Result classes have been restructured and moved to a 'reading' sub-package while the ManipulationQuery classes have been moved to a 'writing' sub-package, for better separation of concerns. Significant refactorings include removal of the DataSource method from SingleResult, adding new comments to various classes for improved understanding, and renaming of classes.
This update moves classes related to 'Result' to the 'reading' sub-package, and those related to 'ManipulationQuery' are shifted to 'writing' for better context separation. It also enhances code readability through added comments, renaming of classes and other significant refactorings.
Changed the import path of 'Result' class to the sub-package 'reading'. This reorganization improves context separation and enhances code readability.
Updated the ConnectionProvider and QueryProvider interfaces. ConnectionProvider now uses a Supplier and a functional interface instead of the direct Connection method. Similarly, QueryProvider has new methods for its default connection and includes a method for query configurations. These changes aid in better error handling and improve code readability and flexibility.
Integrated the use of MapperConfig in QueryReader replacing the previously used MapperConfig.DEFAULT. The MapperConfig is now injected directly into the methods and the abstract mapperConfig() method has been added for override in AutoMappedQuery. This change improves the flexibility of the mapping configuration.
The sadu-mapper project was added to the build scripts of sadu-mariadb, sadu-mysql, and sadu-sqlite. This addition will enable these projects to handle more complex mapping scenarios efficiently.
Removed dependency on QueryBuilderConfig in the PostgreSqlUpdater constructor, simplifying its parameters. The dependency has been re-organized to enhance the efficiency of code and ensure a stable version of the project.
The `ResultCall` class was unused and has been removed from the codebase. This helps to streamline the code by eliminating unnecessary files and making the code easier to maintain and navigate.
The code now throws `WrappedQueryExecutionException` when there's a SQLException while setting database connection's auto commit. This allows a more specific exception handling, improving error tracing and data integrity in case of failures.
Modified the 'connection()' method in QueryConfiguration class to throw an IllegalStateException. This exception is thrown when there's an attempt to retrieve a configuration without creating a connection using 'withSingleTransaction'. This change improves error handling and application's stability by enforcing correct usage of the configuration.
Changed the signature of the 'map' function in the User class to return an instance of RowMapping instead of User. This change simplifies the User mapping used in all query test cases, making the code more readable and maintainable.
Javadocs have been added to most methods in the QueryConfiguration class, improving code readability and clarity of method purposes. Each JavaDoc provides a brief explanation of the method's functionality, its parameters, and what it returns.
Informative Javadocs have been added to several methods in the QueryConfigurationBuilder class. These new comments provide vital insights into the purpose and usage of each method, significantly improving code readability and understandability. Each JavaDoc includes a brief description of the method, its parameters, and its return value.
The getDefault method in QueryConfiguration class has been improved to throw an exception when called before the DEFAULT is set, instead of returning null. This change makes it clearer to developers that they need to call the setDefault method before calling getDefault, thus preventing potential misuse of the method and enhancing the overall code quality.
A new default method has been added in the ParsedQuery class that allows defining a call without any parameter set. This new method returns a called batch query and uses the Calls.empty method. This update simplifies the process of defining a call when no parameters are involved.
Removed batch and single call creation from the Calls class and added them directly to the Call class by introduction of asSingleCall and asBatchCall methods. This streamlines the calling process and eliminates the need for indirect executions of calls via the Calls class. The ParsedQuery's single method now uses Call's asSingleCall directly.
Method calls in ReadTest.java and TransactionTest.java have been updated to use the new direct call and binding methods introduced in the Call class, eliminating the need for indirect execution via the Calls class. These changes simplify the calling process and streamline code for query bindings and executions using the ParsedQuery's single method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I can't say anything about the tests because I'm too inexperienced
sadu-queries2/src/main/java/de/chojo/sadu/queries/calls/Calls.java
Outdated
Show resolved
Hide resolved
...-queries2/src/main/java/de/chojo/sadu/queries/configuration/ConnectedQueryConfiguration.java
Outdated
Show resolved
Hide resolved
sadu-queries2/src/main/java/de/chojo/sadu/queries/configuration/QueryConfiguration.java
Outdated
Show resolved
Hide resolved
Methods connection() and hasConnection() from QueryConfiguration have been removed to simplify the code. They have been replaced by a check for instance of ConnectedQueryConfiguration, a change that has been reflected in QueryImpl. This will remove redundancy and improve the code's readability.
Added module-info.java files in both sadu-mapper and sadu-core directories to manage module dependencies and exports. This inclusion will help to better manage internal dependencies and explicitly define packages that should be exposed to other modules, improving project structure and clarity.
Default constructors for MapperConfig and RowMapperRegistry classes have been added in this commit. These constructors were added to ensure easier instantiation of the objects and maintain the default values of class variables.
The import paths of various classes have been refactored across multiple files in the test folder. This refactoring corrects the paths, pointing them towards their new locations following recent changes in the package structure.
This commit consists of deletion and re-creation of the `Adapter` and `Call` interfaces, as well as their accompanying classes. The interfaces have been relocated as per the new project structure. Changes include deletion of old interfaces, creation of new interfaces under appropriate packages and modification of corresponding methods and functions.
The commit incorporates the deletion of the StandardAdapter class, the moving of the UUIDAdapter class from the 'impl' directory to the parent directory 'adapter', and the creation of a new StandardAdapter class with an extended functionality. These adjustments are in line with the revised project structure and serve to improve code organization and readability.
This commit renames the full path of 'Calls.java', moving it from 'queries/calls' to 'queries/api/call/calls'. This also includes the modification of package paths to maintain consistency and the addition of calls for 'BatchCall' and 'SingletonCall'. These changes improve the organization and visibility of call-related classes within the project structure.
This commit incorporates a new file, 'CallImpl.java', that handles the execution of single query calls. The new class also features multiple bind methods for various data types and conversion functions for different call types, like 'BatchCall' and 'SingletonCall'. This advance broadens the program's data handling capabilities and readies the application for more complex query executions.
This commit includes a cleanup of the query API by moving some classes to specific namespaces, adjusting the imports as necessary. Simultaneously, improvements have been made to code documentation for enhanced readability and understanding of the classes 'SingletonCall.java' and 'BatchCall.java'. The changes contribute to simpler future code interactions and improved maintainability.
This commit involves creating a new module-info.java file in the sadu-queries2 module. This file specifies dependencies and exports within the package, ensuring correct use of libraries and facilitating code isolation and encapsulation. The structured organization in the sadu queries hierarchy will enable more efficient future usage and modification.
This commit restructures package locations, renames several classes and interfaces, and updates import statements in the sadu-queries2 module. Many classes have moved from the "stages" and "params" packages to the "query", "parameter", "api.base" and "api.parameter" packages, respecting a semantic organization. Moreover, some classes and interfaces have been renamed to harmonize the naming scheme, improving readability and comprehension of the codebase.
Added multiple package-info.java files in the sadu-queries2 module to define API and implementation details. This includes creating packages for different aspects of query execution, result handling, query storage, and more. These changes ensure better organization and segregation of responsibilities in the codebase.
Reorganized the definitions for sadu-queries2 in module-info.java. Exports for new query packages have been added further segregating the code by responsibility thereby improving code organization and maintaining clarity in defining API and implementing details.
I made a general cleanup of the whole module structure. all interfaces for the api are now grouped in the api package. Diff: 48e7769...3abd3da |
Refactored the method signature in StandardAdapter for better handling of Object[] type. Added new binding methods in Call and CallImpl, allowing easier binding of Collection<?> and Object[] structures. This increases versatility in data type binding.
Playground for a new query builder, which is less restrictive on actions and allows to reuse results of previous queries and more.
Todo