Mercurial > hg > monetdb-java
comparison src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 377:8a813f5cef1b
Extend StartOfHeaderParser with method getNextAsLong() and change type of tuplecount to long.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Fri, 25 Sep 2020 18:51:58 +0200 (2020-09-25) |
parents | ffdc7b0e102d |
children | 02f353f62abe |
comparison
equal
deleted
inserted
replaced
376:ffdc7b0e102d | 377:8a813f5cef1b |
---|---|
2061 // {{{ ResultSetResponse class implementation | 2061 // {{{ ResultSetResponse class implementation |
2062 final class ResultSetResponse implements Response { | 2062 final class ResultSetResponse implements Response { |
2063 /** The number of columns in this result */ | 2063 /** The number of columns in this result */ |
2064 public final int columncount; | 2064 public final int columncount; |
2065 /** The total number of rows this result set has */ | 2065 /** The total number of rows this result set has */ |
2066 public final int tuplecount; | 2066 public final long tuplecount; |
2067 /** The numbers of rows to retrieve per DataBlockResponse */ | 2067 /** The numbers of rows to retrieve per DataBlockResponse */ |
2068 private int cacheSize; | 2068 private int cacheSize; |
2069 /** The table ID of this result */ | 2069 /** The table ID of this result */ |
2070 public final int id; | 2070 public final int id; |
2071 /** The names of the columns in this result */ | 2071 /** The names of the columns in this result */ |
2117 * supply new result blocks when necessary | 2117 * supply new result blocks when necessary |
2118 * @param seq the query sequence number | 2118 * @param seq the query sequence number |
2119 */ | 2119 */ |
2120 ResultSetResponse( | 2120 ResultSetResponse( |
2121 final int id, | 2121 final int id, |
2122 final int tuplecount, | 2122 final long tuplecount, |
2123 final int columncount, | 2123 final int columncount, |
2124 final int rowcount, | 2124 final int rowcount, |
2125 final MonetConnection.ResponseList parent, | 2125 final MonetConnection.ResponseList parent, |
2126 final int seq) | 2126 final int seq) |
2127 throws SQLException | 2127 throws SQLException |
2154 destroyOnClose = id > 0 && tuplecount > rowcount; | 2154 destroyOnClose = id > 0 && tuplecount > rowcount; |
2155 | 2155 |
2156 this.id = id; | 2156 this.id = id; |
2157 this.tuplecount = tuplecount; | 2157 this.tuplecount = tuplecount; |
2158 this.columncount = columncount; | 2158 this.columncount = columncount; |
2159 this.resultBlocks = new DataBlockResponse[(tuplecount / cacheSize) + 1]; | 2159 this.resultBlocks = new DataBlockResponse[(int)(tuplecount / cacheSize) + 1]; |
2160 | 2160 |
2161 hlp = new HeaderLineParser(columncount); | 2161 hlp = new HeaderLineParser(columncount); |
2162 | 2162 |
2163 resultBlocks[0] = new DataBlockResponse(rowcount, parent.rstype == ResultSet.TYPE_FORWARD_ONLY); | 2163 resultBlocks[0] = new DataBlockResponse(rowcount, parent.rstype == ResultSet.TYPE_FORWARD_ONLY); |
2164 } | 2164 } |
2885 case StartOfHeaderParser.Q_PARSE: | 2885 case StartOfHeaderParser.Q_PARSE: |
2886 throw new MCLParseException("Q_PARSE header not allowed here", 1); | 2886 throw new MCLParseException("Q_PARSE header not allowed here", 1); |
2887 case StartOfHeaderParser.Q_TABLE: | 2887 case StartOfHeaderParser.Q_TABLE: |
2888 case StartOfHeaderParser.Q_PREPARE: { | 2888 case StartOfHeaderParser.Q_PREPARE: { |
2889 final int id = sohp.getNextAsInt(); | 2889 final int id = sohp.getNextAsInt(); |
2890 int tuplecount = sohp.getNextAsInt(); // TODO implement StartOfHeaderParser.getNextAsLong() and change tuplecount to long | 2890 long tuplecount = sohp.getNextAsLong(); |
2891 final int columncount = sohp.getNextAsInt(); | 2891 final int columncount = sohp.getNextAsInt(); |
2892 final int rowcount = sohp.getNextAsInt(); | 2892 final int rowcount = sohp.getNextAsInt(); |
2893 // enforce the maxrows setting | 2893 // enforce the maxrows setting |
2894 if (maxrows != 0 && tuplecount > maxrows) | 2894 if (maxrows != 0 && tuplecount > maxrows) |
2895 tuplecount = (int)maxrows; | 2895 tuplecount = maxrows; |
2896 res = new ResultSetResponse(id, tuplecount, columncount, rowcount, this, seqnr); | 2896 res = new ResultSetResponse(id, tuplecount, columncount, rowcount, this, seqnr); |
2897 // only add this resultset to the hashmap if it can possibly have an additional datablock | 2897 // only add this resultset to the hashmap if it can possibly have an additional datablock |
2898 if (rowcount < tuplecount) { | 2898 if (rowcount < tuplecount) { |
2899 if (rsresponses == null) | 2899 if (rsresponses == null) |
2900 rsresponses = new HashMap<Integer, ResultSetResponse>(); | 2900 rsresponses = new HashMap<Integer, ResultSetResponse>(); |