Changeset 3464 for DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcCachedRepresentationDao.java
- Timestamp:
- 08/23/13 16:23:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcCachedRepresentationDao.java
r3463 r3464 49 49 public CachedRepresentationInfo getCachedRepresentationInfo(Number internalID) { 50 50 51 String sql = "SELECT " + cachedRepresentationStar + " FROM " + cachedRepresentationTableName + " WHERE " + cached_representation_id + "= ? LIMIT 1"; 52 List<CachedRepresentationInfo> result = getSimpleJdbcTemplate().query(sql, cachedRepresentationRowMapper, internalID); 51 StringBuilder sql = new StringBuilder("SELECT "); 52 sql.append(cachedRepresentationStar).append(" FROM ").append(cachedRepresentationTableName).append(" WHERE ").append(cached_representation_id).append("= ? LIMIT 1"); 53 List<CachedRepresentationInfo> result = getSimpleJdbcTemplate().query(sql.toString(), cachedRepresentationRowMapper, internalID); 53 54 54 55 if (result.isEmpty()) { … … 73 74 74 75 private boolean cachedIsInUse(Number cachedID) { 75 String sql = "SELECT " + version_id + " FROM " + versionsCachedRepresentationsTableName + " WHERE " + cached_representation_id + "= ? LIMIT 1"; 76 List<Number> result = getSimpleJdbcTemplate().query(sql, versionIDRowMapper, cachedID); 76 StringBuilder sql = new StringBuilder("SELECT "); 77 sql.append(version_id).append(" FROM ").append(versionsCachedRepresentationsTableName).append(" WHERE ").append(cached_representation_id).append("= ? LIMIT 1"); 78 List<Number> result = getSimpleJdbcTemplate().query(sql.toString(), versionIDRowMapper, cachedID); 77 79 return (!result.isEmpty()); 78 80 } … … 89 91 params.put("tool", cached.getTool()); 90 92 params.put("type", cached.getType()); 91 String sql = "INSERT INTO " + cachedRepresentationTableName + "(" + external_id + "," + mime_type + "," + tool + "," + type_ + " ) VALUES (:externalId, :mime_type, :tool, :type)"; 92 final int affectedRows = getSimpleJdbcTemplate().update(sql, params); 93 StringBuilder sql = new StringBuilder("INSERT INTO "); 94 sql.append(cachedRepresentationTableName).append("(").append(external_id).append(",").append(mime_type).append(",").append(tool).append("," ).append(type_).append(" ) VALUES (:externalId, :mime_type, :tool, :type)"); 95 final int affectedRows = getSimpleJdbcTemplate().update(sql.toString(), params); 93 96 return (affectedRows > 0 ? getInternalID(externalIdentifier) : null); 94 97 } … … 101 104 } 102 105 103 String sql = "DELETE FROM " + cachedRepresentationTableName + " where " + cached_representation_id + " = ?"; 104 return getSimpleJdbcTemplate().update(sql, internalID); 106 StringBuilder sql = new StringBuilder("DELETE FROM "); 107 sql.append(cachedRepresentationTableName).append(" WHERE ").append(cached_representation_id).append(" = ?"); 108 return getSimpleJdbcTemplate().update(sql.toString(), internalID); 105 109 } 106 110
Note: See TracChangeset
for help on using the changeset viewer.