Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

Metamodel 1132 sql native paging #137

Closed

Conversation

rposkocil
Copy link
Contributor

- set for SQLServer 2012+ and Oracle 12+
- added new tests of the clause creation
- fix tests of SQL Server and Oracle
Copy link
Contributor

@LosD LosD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues, but overall looks like a sound solution to me


public OracleQueryRewriter(JdbcDataContext dataContext) {
super(dataContext);
super(dataContext, 11);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to use a constant here to document the magic number, like FIRST_FETCH_SUPPORTING_VERSION (or maybe something a little less clumsy than what I came up with 😄).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I thought it was only supported from version 12c in Oracle?

@@ -460,4 +460,25 @@ public Object getResultSetValue(ResultSet resultSet, int columnIndex, Column col
}
return resultSet.getObject(columnIndex);
}

protected boolean isSupportedDatabase(String databaseProductName, int databaseVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be limited to isSupportedVersion? I mean, hopefully the concrete rewriters know what product they are.

@Override
public boolean isMaxRowsSupported() {
return true;
super(dataContext, 11);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also magic number here

@LosD
Copy link
Contributor

LosD commented Dec 9, 2016

BTW, not a blocker for me, but you could consider to use a separate class that are used by SQL Server and Oracle rewriters instead of inheritance for this. It's not really a problem now, but if we want to use other features that are shared between some database engines, this design will break down rather quickly.

return false;
}

private int databaseVersionToInt(String version) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call this method something like getDatabaseMajorVersion() just because it will return the major version element only, not something that represents the 'real' version.

firstDot = version.indexOf('.');
}
if(firstDot >= 0) {
return Integer.valueOf(version.substring(0, firstDot));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could throw an exception if the version from the DB is something like R12.0.

firstDot = version.indexOf('.');
}
if(firstDot >= 0) {
return Integer.valueOf(version.substring(0, firstDot));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to make this more "defensive" in terms of programming. I can't imagine it really, but if the string argument is just "." then this substring will return empty string and that will throw exception when parsing as integer. It's not really something I think is likely to happen, but just saying :-)

@kaspersorensen
Copy link
Contributor

LGTM

@JoosjeBoon
Copy link

Shall we pull then? I want to test this using the DH connector. Thanks guys!

@asfgit asfgit closed this in 95fa617 Dec 21, 2016
@LosD
Copy link
Contributor

LosD commented Dec 21, 2016

Merged :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants