-
Notifications
You must be signed in to change notification settings - Fork 24
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
refactor: A new dockerfile for the connector, restructuring of the codebase, sorting of the imports #55
Conversation
Signed-off-by: Joel Hanson <[email protected]> Signed-off-by: Joel Hanson <[email protected]>
58f88b9
to
e6b1e8d
Compare
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.
A couple of tidy up suggestions left
@@ -0,0 +1,172 @@ | |||
package com.ibm.eventstreams.connect.jdbcsink.database.builder; |
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.
Copy right headers are required at the top of new files and edited files will need updating
|
||
public IDataSource dataSource = null; | ||
|
||
public CommandBuilder(IDataSource connection) { |
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.
These names are not quite lined up. Either the object is a data source or it is a connection to the data source? Would it be possible to clarify this?
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.
I have split out class into command builder and database factory which makes it having individual behavior.
sb.append("INSERT INTO ").append(tableName); | ||
sb.append("(").append(String.join(", ", fieldNames)).append(")"); | ||
sb.append(" VALUES "); | ||
sb.append("(").append(String.join(", ", Collections.nCopies(fieldNames.size(), "?"))).append(")"); |
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.
Do we have any command builder tests? It is not clear why we are adding an n fold collection of "?" to this command some tests would make this class easier to understand
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.
The preparestatement replaces those ? with values for example.
PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
src/main/java/com/ibm/eventstreams/connect/jdbcsink/database/writer/JDBCWriter.java
Show resolved
Hide resolved
bcffb39
to
373efad
Compare
Signed-off-by: Joel Hanson <[email protected]>
Signed-off-by: Joel Hanson <[email protected]>
06eb7e3
to
b51f455
Compare
Signed-off-by: Joel Hanson <[email protected]>
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.
LGTM, nice work Joel!
Description
Reafactor the code to move all the command build related method to a different class
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist