ARTEMIS-1653 Allow database tables to be created externally#1986
ARTEMIS-1653 Allow database tables to be created externally#1986franz1981 wants to merge 1 commit into
Conversation
|
@clebertsuconic I haven't reverted tha change made by ef74221 but isn't necessary anymore, because with this fix it works without the change too. |
nlippke
left a comment
There was a problem hiding this comment.
Statement-checks are all uppercase. Implementors using this method need to be aware of it. Apart from that looks good.
Thanks for the note 👍 I have added a |
The previous commit about this feature wasn't using the right ResultSet to count the rows in a table. Additional checks have been added to: - verify that the first SQL statement is a CREATE TABLE - log if the existing rows are less than the expected ones
| if (cntRs.next() && (rows = cntRs.getInt(1)) > 0) { | ||
| logger.tracef("Table %s did exist but is not empty. Skipping initialization.", tableName); | ||
| if (logger.isDebugEnabled()) { | ||
| final long expectedRows = Stream.of(sqls).map(String::toUpperCase).filter(sql -> sql.contains("INSERT INTO")).count(); |
There was a problem hiding this comment.
Are you sure you meant this INSERT to only happen if debug?
There was a problem hiding this comment.
Nope, I meant that the check should be performed only with debug log level to help spotting weird behaviours.
It is not the most robust check ever, but it is pretty helpfull for HA (for example).
There was a problem hiding this comment.
@clebertsuconic Please do not merge it yet...because on DB2 it is creating some problems.
I will close it to avoid being merged accidentally 👍
The previous commit about this feature wasn't using the right ResultSet
to count the rows in a table.
Additional checks have been added to: