Major changes in code
Hi Guillaume
Squiggle is an incredible library that I was looking for. I plan to use it in my future projects. I hate ORM concept and everything that relies too much on magic of reflection. I just need a simple tool to build SQL queries with a standard OOD toolkit.
However, in attempt to use Squiggle I found some major issues that didn't allow me to complete my task. I've decided to tinker into the library and fix these issues. In the result of 2 days of work, it looks like I've reworked the whole code base. See my fork https://github.com/enepomnyaschih/squiggle-sql
I have the following questions:
- Are you interested in merging this code? I'll open a pull request if you are.
- If not, should I leave you and Joe Walnes as authors of the code even though 80% of code has been rewritten? Should I choose a different package name and maven artifact name?
Here is the log of changes:
- Added PreparedStatement compilation support with SQL "?" query parameters. See StatementTest. Just replace MockStatementCompiler with JdbcStatementCompiler are you'll get a real JDBC PreparedStatement to work with.
- Added conflict-free automated alias generation logic. Call "table.refer()" method to obtain a TableReference - a new alias to use in the query. The queries should be built with TableReferences now, not with Tables. See the updated TutorialTest.
- Added ResultColumn class returned by addToSelection method. You can use its getIndex method to get the values from the ResultSet by index. You can also use it to order the results by a ResultColumn.
- Added Literal.of method to build all kinds of supported literals with NullPointerException protection.
- Added InsertQuery and UpdateQuery.
- Added TypeCast selectable.
- Slightly improved implementation of criterias, made it more coincise.
- Unified and tested CollectionWriter algorithm.
- Added Java 8 support with its related parameter types (such as java.time.Instant). Left legacy Java 6 version in java6legacy branch.
Here is some work that I plan to do in the future:
- Escape table/column names that are SQL reserved words.
- Add possibility to force used-defined table and result aliases to be used (this feature existed in the previous implementation, but I've decided to give alias auto-generation a higher value and priority than maintain this feature).
- Add more parameter types.
- Increase test coverage.
Thank you for your time.
Best regards, Egor.
Hi Egor,
First, sorry for my very long time before responding to you, You done a great work, congratulation ! I've no time to work on any open source projects at the moment, I grant you the right to fork it and publish it under a new package convention. Please, notify me when you will provide your first release, I will mark my project as deprecated with a redirect to your project.
Cheer!
Le mar. 1 janv. 2019 à 16:18, Egor Nepomnyaschih [email protected] a écrit :
Hi Guillaume
Squiggle is an incredible library that I was looking for. I plan to use it in my future projects. I hate ORM concept and everything that relies too much on magic of reflection. I just need a simple tool to build SQL queries with a standard OOD toolkit.
However, in attempt to use Squiggle I found some major issues that didn't allow me to complete my task. I've decided to tinker into the library and fix these issues. In the result of 2 days of work, it looks like I've reworked the whole code base. See my fork https://github.com/enepomnyaschih/squiggle-sql
I have the following questions:
- Are you interested in merging this code? I'll open a pull request if you are.
- If not, should I leave you and Joe Walnes as authors of the code even though 80% of code has been rewritten? Should I choose a different package name and maven artifact name?
Here is the log of changes:
- Added PreparedStatement compilation support with SQL "?" query parameters. See StatementTest https://github.com/enepomnyaschih/squiggle-sql/blob/master/src/test/java/io/zatarox/squiggle/StatementTest.java. Just replace MockStatementCompiler with JdbcStatementCompiler are you'll get a real JDBC PreparedStatement to work with.
- Added conflict-free automated alias generation logic. Call "table.refer()" method to obtain a TableReference - a new alias to use in the query. The queries should be built with TableReferences now, not with Tables. See the updated TutorialTest https://github.com/enepomnyaschih/squiggle-sql/blob/master/src/test/java/io/zatarox/squiggle/TutorialTest.java .
- Added ResultColumn class returned by addToSelection method. You can use its getIndex method to get the values from the ResultSet by index. You can also use it to order the results by a ResultColumn.
- Added Literal.of method to build all kinds of supported literals with NullPointerException protection.
- Added InsertQuery and UpdateQuery.
- Added TypeCast selectable.
- Slightly improved implementation of criterias, made it more coincise.
- Unified and tested CollectionWriter algorithm.
- Added Java 8 support with its related parameter types (such as java.time.Instant). Left legacy Java 6 version in java6legacy branch.
Here is some work that I plan to do in the future:
- Escape table/column names that are SQL reserved words.
- Add possibility to force used-defined table and result aliases to be used (this feature existed in the previous implementation, but I've decided to give alias auto-generation a higher value and priority than maintain this feature).
- Add more parameter types.
- Increase test coverage.
Thank you for your time.
Best regards, Egor.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gchauvet/squiggle-sql/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJlLKIu0yOi5A_fPOInyreFRPgKcBo4ks5u-3xWgaJpZM4Zl7pT .
Thank you, I'll notify you once the release is ready.
@gchauvet - FYI, I've moved the code base to https://github.com/squigglesql/squigglesql/ as the module publishing in a SonaType repository would require me to use my GitHub username in Maven group ID, which would look awkward. I expect to publish the first big release by the end of April.
@gchauvet - Hi, I released Squiggle 4
https://github.com/squigglesql/squigglesql/ https://search.maven.org/artifact/com.github.squigglesql/squigglesql/4.0.0/jar