postgresql-jdbc.git / summary / log / commit / refs

commit    c425bd7f348e58eea2cd3b2a626e37cf5b4d9319
Author:   Dave Cramer <davecramer@gmail.com>
Date:     Fri Jan 11 18:21:56 2013 +0000

    Fixed my patch to deal with update counts over 2^32
    Check to see if the update count is greater than Integer.MAX_VALUE before
    setting the update_count to Statement.SUCCESS_NO_INFO
    NumberFormatException will still be thrown if there is a problem
    parsing it.


org/postgresql/core/v2/QueryExecutorImpl.java | 10 ++++++++-- org/postgresql/core/v3/QueryExecutorImpl.java | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/org/postgresql/core/v2/QueryExecutorImpl.java b/org/postgresql/core/v2/QueryExecutorImpl.java index 24fb0ddd..324d536c 100644 --- a/org/postgresql/core/v2/QueryExecutorImpl.java +++ b/org/postgresql/core/v2/QueryExecutorImpl.java @@ -587,14 +587,20 @@ public class QueryExecutorImpl implements QueryExecutor { { try { - update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' '))); + long updates = Long.parseLong(status.substring(1 + status.lastIndexOf(' '))); + + // deal with situations where the update modifies more than 2^32 rows + if ( updates > Integer.MAX_VALUE ) + update_count = Statement.SUCCESS_NO_INFO; + if (status.startsWith("INSERT")) insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '), status.lastIndexOf(' '))); } catch (NumberFormatException nfe) { - update_count=Statement.SUCCESS_NO_INFO; + handler.handleError(new PSQLException(GT.tr("Unable to interpret the update count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE)); + return ; } } diff --git a/org/postgresql/core/v3/QueryExecutorImpl.java b/org/postgresql/core/v3/QueryExecutorImpl.java index 3dee95d2..e6f81db6 100644 --- a/org/postgresql/core/v3/QueryExecutorImpl.java +++ b/org/postgresql/core/v3/QueryExecutorImpl.java @@ -2189,14 +2189,20 @@ public class QueryExecutorImpl implements QueryExecutor { { try { - update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' '))); + long updates = Long.parseLong(status.substring(1 + status.lastIndexOf(' '))); + + // deal with situations where the update modifies more than 2^32 rows + if ( updates > Integer.MAX_VALUE ) + update_count = Statement.SUCCESS_NO_INFO; + if (status.startsWith("INSERT")) insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '), status.lastIndexOf(' '))); } catch (NumberFormatException nfe) { - update_count=Statement.SUCCESS_NO_INFO; + handler.handleError(new PSQLException(GT.tr("Unable to interpret the update count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE)); + return ; } } [parent: 87959fe4ec03]