Mercurial > hg > monetdb-java
comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @ 8:a27ee2cb14a0
Replace String methods equals("") and "".equals( with isEmpty()
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 29 Sep 2016 15:29:42 +0200 (2016-09-29) |
parents | a5a898f6886c |
children | 5ec116ba7d71 |
comparison
equal
deleted
inserted
replaced
7:b3ca1157be73 | 8:a27ee2cb14a0 |
---|---|
66 // initialize this class: register it at the DriverManager | 66 // initialize this class: register it at the DriverManager |
67 // Chapter 9.2 from Sun JDBC 3.0 specification | 67 // Chapter 9.2 from Sun JDBC 3.0 specification |
68 static { | 68 static { |
69 try { | 69 try { |
70 DriverManager.registerDriver(new MonetDriver()); | 70 DriverManager.registerDriver(new MonetDriver()); |
71 } catch (SQLException e) { | 71 } catch (SQLException e) { |
72 e.printStackTrace(); | 72 e.printStackTrace(); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 //== methods of interface Driver | 76 //== methods of interface Driver |
145 | 145 |
146 // check the database | 146 // check the database |
147 String uri_path = uri.getPath(); | 147 String uri_path = uri.getPath(); |
148 if (uri_path != null && uri_path.length() != 0) { | 148 if (uri_path != null && uri_path.length() != 0) { |
149 uri_path = uri_path.substring(1); | 149 uri_path = uri_path.substring(1); |
150 if (!uri_path.trim().equals("")) | 150 if (!uri_path.trim().isEmpty()) |
151 info.put("database", uri_path); | 151 info.put("database", uri_path); |
152 } | 152 } |
153 | 153 |
154 String uri_query = uri.getQuery(); | 154 String uri_query = uri.getQuery(); |
155 if (uri_query != null) { | 155 if (uri_query != null) { |
356 private static String TypeMapppingSQL = null; // cache to optimise getSQLTypeMap() | 356 private static String TypeMapppingSQL = null; // cache to optimise getSQLTypeMap() |
357 static String getSQLTypeMap(String column) { | 357 static String getSQLTypeMap(String column) { |
358 if (TypeMapppingSQL == null) { | 358 if (TypeMapppingSQL == null) { |
359 // first time, compose TypeMappping SQL string | 359 // first time, compose TypeMappping SQL string |
360 StringBuilder val = new StringBuilder((typeMap.size() * (7 + 7 + 7 + 4)) + 14); | 360 StringBuilder val = new StringBuilder((typeMap.size() * (7 + 7 + 7 + 4)) + 14); |
361 for (Entry<String, Integer> entry : typeMap.entrySet()) { | 361 for (Entry<String, Integer> entry : typeMap.entrySet()) { |
362 val.append(" WHEN '").append(entry.getKey()).append("' THEN ").append(entry.getValue().toString()); | 362 val.append(" WHEN '").append(entry.getKey()).append("' THEN ").append(entry.getValue().toString()); |
363 } | 363 } |
364 val.append(" ELSE ").append(Types.OTHER).append(" END"); | 364 val.append(" ELSE ").append(Types.OTHER).append(" END"); |
365 // as the typeMap is static, cache this SQL part for all next calls | 365 // as the typeMap is static, cache this SQL part for all next calls |
366 TypeMapppingSQL = val.toString(); | 366 TypeMapppingSQL = val.toString(); |
367 } | 367 } |
368 return "CASE " + column + TypeMapppingSQL; | 368 return "CASE " + column + TypeMapppingSQL; |