diff options
author | Anna Koskinen <anna@vaadin.com> | 2013-01-31 17:29:25 +0200 |
---|---|---|
committer | Anna Koskinen <anna@vaadin.com> | 2013-02-05 15:57:45 +0200 |
commit | 515d3c39e3a02e4dc266cac7fd6919748a10e243 (patch) | |
tree | a8c5ca2a6e2d2fe813f7827d26bc6cf7e67f6977 /server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java | |
parent | d597fe70a98ae356414c27d1372005023053f44c (diff) | |
download | vaadin-framework-515d3c39e3a02e4dc266cac7fd6919748a10e243.tar.gz vaadin-framework-515d3c39e3a02e4dc266cac7fd6919748a10e243.zip |
Merge of (#10563) to Vaadin 7.
Use template strings and log level checks to improve performance when
logging is disabled.
Change-Id: I48d370f523c6361ce8704afc7a0903412b31b2a0
Diffstat (limited to 'server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java')
-rw-r--r-- | server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java b/server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java index 246384ee57..eba8b652af 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/query/TableQuery.java @@ -241,7 +241,7 @@ public class TableQuery implements QueryDelegate, PreparedStatement pstmt = activeConnection.prepareStatement( sh.getQueryString(), primaryKeyColumns.toArray(new String[0])); sh.setParameterValuesToStatement(pstmt); - getLogger().log(Level.FINE, "DB -> " + sh.getQueryString()); + getLogger().log(Level.FINE, "DB -> {0}", sh.getQueryString()); int result = pstmt.executeUpdate(); if (result > 0) { /* @@ -408,7 +408,7 @@ public class TableQuery implements QueryDelegate, } PreparedStatement pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); - getLogger().log(Level.FINE, "DB -> " + sh.getQueryString()); + getLogger().log(Level.FINE, "DB -> {0}", sh.getQueryString()); return pstmt.executeQuery(); } @@ -434,7 +434,7 @@ public class TableQuery implements QueryDelegate, } pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); - getLogger().log(Level.FINE, "DB -> " + sh.getQueryString()); + getLogger().log(Level.FINE, "DB -> {0}", sh.getQueryString()); int retval = pstmt.executeUpdate(); return retval; } finally { @@ -477,7 +477,7 @@ public class TableQuery implements QueryDelegate, pstmt = c.prepareStatement(sh.getQueryString(), primaryKeyColumns.toArray(new String[0])); sh.setParameterValuesToStatement(pstmt); - getLogger().log(Level.FINE, "DB -> " + sh.getQueryString()); + getLogger().log(Level.FINE, "DB -> {0}", sh.getQueryString()); int result = pstmt.executeUpdate(); genKeys = pstmt.getGeneratedKeys(); RowId newId = getNewRowId(row, genKeys); @@ -590,8 +590,10 @@ public class TableQuery implements QueryDelegate, } return new RowId(newRowId.toArray()); } catch (Exception e) { - getLogger().log(Level.FINE, - "Failed to fetch key values on insert: " + e.getMessage()); + getLogger() + .log(Level.FINE, + "Failed to fetch key values on insert: {0}", + e.getMessage()); return null; } } @@ -606,8 +608,8 @@ public class TableQuery implements QueryDelegate, @Override public boolean removeRow(RowItem row) throws UnsupportedOperationException, SQLException { - getLogger().log(Level.FINE, - "Removing row with id: " + row.getId().getId()[0].toString()); + getLogger().log(Level.FINE, "Removing row with id: {0}", + row.getId().getId()[0].toString()); if (executeUpdate(sqlGenerator.generateDeleteQuery(getTableName(), primaryKeyColumns, versionColumn, row)) == 1) { return true; |