Skip to content
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

Fixes issue #30. No more NPE. #31

Merged
merged 1 commit into from
Sep 23, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/main/java/org/drizzle/jdbc/DrizzleStatement.java
Expand Up @@ -737,10 +737,10 @@ public ResultSet getResultSet() throws SQLException {
}

public int getUpdateCount() throws SQLException {
if(queryResult.getResultSetType() == ResultSetType.SELECT) {
if(queryResult != null && queryResult.getResultSetType() == ResultSetType.SELECT) {
return -1;
}
return (int) ((ModifyQueryResult) queryResult).getUpdateCount();
return (int)updateCount;
}

/**
Expand All @@ -765,10 +765,18 @@ public boolean getMoreResults() throws SQLException {
}

queryResult = protocol.getMoreResults();
if(queryResult == null) return false;
if(queryResult == null) {
this.resultSet=null;
setUpdateCount(-1);
return false;
}
warningsCleared = false;
this.resultSet = new DrizzleResultSet(queryResult, this, getProtocol());
return true;
if (queryResult.getResultSetType() == ResultSetType.SELECT) {
setResultSet(new DrizzleResultSet(queryResult, this, getProtocol()));
return true;
}
setUpdateCount((int)((ModifyQueryResult) queryResult).getUpdateCount());
return false;
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
Expand Down