comparison src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 178:dd12348c41cf

Improvement: only extend typeMap when the property was set to true.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 05 Oct 2017 15:00:26 +0200 (2017-10-05)
parents 8700d9ef2ace
children e0f76fedafc8
comparison
equal deleted inserted replaced
177:4959b85b981c 178:dd12348c41cf
205 205
206 String treatBlobAsVarBinary_prop = props.getProperty("treat_blob_as_binary"); 206 String treatBlobAsVarBinary_prop = props.getProperty("treat_blob_as_binary");
207 if (treatBlobAsVarBinary_prop != null) { 207 if (treatBlobAsVarBinary_prop != null) {
208 treatBlobAsVarBinary = Boolean.parseBoolean(treatBlobAsVarBinary_prop); 208 treatBlobAsVarBinary = Boolean.parseBoolean(treatBlobAsVarBinary_prop);
209 conn_props.setProperty("treat_blob_as_binary", Boolean.toString(treatBlobAsVarBinary)); 209 conn_props.setProperty("treat_blob_as_binary", Boolean.toString(treatBlobAsVarBinary));
210 typeMap.put("blob", Byte[].class); 210 if (treatBlobAsVarBinary)
211 typeMap.put("blob", Byte[].class);
211 } 212 }
212 213
213 String treatClobAsVarChar_prop = props.getProperty("treat_clob_as_varchar"); 214 String treatClobAsVarChar_prop = props.getProperty("treat_clob_as_varchar");
214 if (treatClobAsVarChar_prop != null) { 215 if (treatClobAsVarChar_prop != null) {
215 treatClobAsVarChar = Boolean.parseBoolean(treatClobAsVarChar_prop); 216 treatClobAsVarChar = Boolean.parseBoolean(treatClobAsVarChar_prop);
216 conn_props.setProperty("treat_clob_as_varchar", Boolean.toString(treatClobAsVarChar)); 217 conn_props.setProperty("treat_clob_as_varchar", Boolean.toString(treatClobAsVarChar));
217 typeMap.put("clob", String.class); 218 if (treatClobAsVarChar)
219 typeMap.put("clob", String.class);
218 } 220 }
219 221
220 int sockTimeout = 0; 222 int sockTimeout = 0;
221 String so_timeout_prop = props.getProperty("so_timeout"); 223 String so_timeout_prop = props.getProperty("so_timeout");
222 if (so_timeout_prop != null) { 224 if (so_timeout_prop != null) {
2547 * Change the reply size of the server. If the given 2549 * Change the reply size of the server. If the given
2548 * value is the same as the current value known to use, 2550 * value is the same as the current value known to use,
2549 * then ignore this call. If it is set to 0 we get a 2551 * then ignore this call. If it is set to 0 we get a
2550 * prompt after the server sent it's header. 2552 * prompt after the server sent it's header.
2551 */ 2553 */
2552 int size = cachesize == 0 ? DEF_FETCHSIZE : cachesize; 2554 int size = (cachesize == 0 ? DEF_FETCHSIZE : cachesize);
2553 size = maxrows != 0 ? Math.min(maxrows, size) : size; 2555 if (maxrows > 0 && maxrows < size)
2556 size = maxrows;
2554 // don't do work if it's not needed 2557 // don't do work if it's not needed
2555 if (lang == LANG_SQL && size != curReplySize && templ != commandTempl) { 2558 if (lang == LANG_SQL && size != curReplySize && templ != commandTempl) {
2556 sendControlCommand("reply_size " + size); 2559 sendControlCommand("reply_size " + size);
2557 2560
2558 // store the reply size after a successful change 2561 // store the reply size after a successful change