Skip to content

Conversation

@skavanagh
Copy link
Contributor

Optimized PROPERTY_MATCH query when returning vulnerabilities from metadata

@skavanagh
Copy link
Contributor Author

Should be able to use an IN statement like so with H2

PreparedStatement prep = conn.prepareStatement(
    "SELECT * FROM TABLE(X INT=?) T INNER JOIN TEST ON T.X=TEST.ID");
prep.setObject(1, new Object[] { "1", "2" });
ResultSet rs = prep.executeQuery();

as per http://www.h2database.com/html/performance.html#database_performance_tuning

@abn
Copy link
Member

abn commented Oct 11, 2014

@skavanagh thank you for the fix, it is a welcome improvement. The changes look good to me, however a few minor non-functional changes will be appreciated.

  • split out the .gitignore commit
  • White space usage consistency; the code changes use a mixture of spaces and tabs, use tabs (4 space).
  • Query string formatting; just for consistency, split the PROPERTY_MATCH initialization and capitalize where required. Maybe something like:
        protected final static String PROPERTY_MATCH = "SELECT record, COUNT(record) as count "
                + "FROM TABLE(p varchar =  ?, v varchar = ? ) t INNER JOIN meta ON t.p = meta.prop AND t.v = meta.value "
                + "GROUP BY record";

@abn abn self-assigned this Oct 11, 2014
@abn abn modified the milestones: 1.4.0, 1.3.3 Oct 11, 2014
@skavanagh
Copy link
Contributor Author

Uhhh!! I think that made it worse. I'll try again tonight, may have to give up and resort to using eclipse 😄

Optimized PROPERTY_MATCH query when returning vulnerabilities from
metadata
@skavanagh
Copy link
Contributor Author

Should be better now! Thanks @abn!!

@abn abn merged commit 8d2a7b6 into victims:master Oct 13, 2014
@abn abn modified the milestones: 1.4.0, 1.3.3 Oct 13, 2014
@abn
Copy link
Member

abn commented Oct 13, 2014

@skavanagh thanks, i have merged the changes. Note I had fix up a few things.

@skavanagh
Copy link
Contributor Author

Great! Thanks @abn!! Sorry about the whitespace issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants