From 8bd7552bf95b803763d85ac02276b2dea3ae9b24 Mon Sep 17 00:00:00 2001 From: bernd Date: Wed, 14 Nov 2012 21:24:30 +0100 Subject: [PATCH 01/25] Replace all tabs with 8 spaces in java source files. --- eodsql/src/net/lemnik/eodsql/QuickQueryUtil.java | 50 ++-- .../eodsql/impl/AbstractMethodImplementation.java | 16 +- .../lemnik/eodsql/impl/ExceptionTranslator.java | 4 +- .../impl/SelectMethodImplementationFactory.java | 12 +- .../lemnik/eodsql/impl/TransactionQueryImpl.java | 38 +-- eodsql/src/net/lemnik/eodsql/spi/Context.java | 2 +- .../eodsql/spi/util/MapDataObjectBinding.java | 266 ++++++++++----------- .../eodsql/spi/util/SingleRowResultSetWrapper.java | 20 +- eodsql/test/net/lemnik/eodsql/SelectIntoTest.java | 12 +- eodsql/test/net/lemnik/eodsql/TypesTest.java | 22 +- 10 files changed, 221 insertions(+), 221 deletions(-) diff --git a/eodsql/src/net/lemnik/eodsql/QuickQueryUtil.java b/eodsql/src/net/lemnik/eodsql/QuickQueryUtil.java index 84562eb..1a7c57b 100644 --- a/eodsql/src/net/lemnik/eodsql/QuickQueryUtil.java +++ b/eodsql/src/net/lemnik/eodsql/QuickQueryUtil.java @@ -95,32 +95,32 @@ class QuickQueryUtil { private static final Update DEFAULT_UPDATE_PARAMETERS = new Update() { - public boolean batchUpdate() { - return false; - } - - public GeneratedKeys keys() { - return GeneratedKeys.NO_KEYS_RETURNED; - } - - @SuppressWarnings("unchecked") - public Class[] parameterBindings() { - return new Class[0]; - } - - public String sql() { - return ""; - } - - public String value() { - return ""; - } - - public Class annotationType() { - return Update.class; - } + public boolean batchUpdate() { + return false; + } + + public GeneratedKeys keys() { + return GeneratedKeys.NO_KEYS_RETURNED; + } + + @SuppressWarnings("unchecked") + public Class[] parameterBindings() { + return new Class[0]; + } + + public String sql() { + return ""; + } + + public String value() { + return ""; + } + + public Class annotationType() { + return Update.class; + } }; - + private QuickQueryUtil() { } diff --git a/eodsql/src/net/lemnik/eodsql/impl/AbstractMethodImplementation.java b/eodsql/src/net/lemnik/eodsql/impl/AbstractMethodImplementation.java index 29216e2..26339e5 100644 --- a/eodsql/src/net/lemnik/eodsql/impl/AbstractMethodImplementation.java +++ b/eodsql/src/net/lemnik/eodsql/impl/AbstractMethodImplementation.java @@ -90,21 +90,21 @@ abstract class AbstractMethodImplementation for(int i = 0; i < parameters; i++) { final Constructor customMapperConstructor - = getConstructor(customTypeMapperClasses, i); + = getConstructor(customTypeMapperClasses, i); if (customMapperConstructor != null) { - try { - mappers[i] = customMapperConstructor.newInstance(); - } catch (Exception ex) { - throw new InvalidQueryException("Cannot construct custom type mapper " - + customMapperConstructor.getName(), ex); - } + try { + mappers[i] = customMapperConstructor.newInstance(); + } catch (Exception ex) { + throw new InvalidQueryException("Cannot construct custom type mapper " + + customMapperConstructor.getName(), ex); + } } else { final TypeMapper mapper = knownMappers.get(query.getParameterType(i)); if(mapper != null) { mappers[i] = mapper; } else { - throw new InvalidQueryException("Unknown primitive type: " + + throw new InvalidQueryException("Unknown primitive type: " + query.getParameterType(i).getName()); } } diff --git a/eodsql/src/net/lemnik/eodsql/impl/ExceptionTranslator.java b/eodsql/src/net/lemnik/eodsql/impl/ExceptionTranslator.java index 3ce4b1c..2952698 100644 --- a/eodsql/src/net/lemnik/eodsql/impl/ExceptionTranslator.java +++ b/eodsql/src/net/lemnik/eodsql/impl/ExceptionTranslator.java @@ -25,7 +25,7 @@ public interface ExceptionTranslator { * the original exception. */ public RuntimeException translateException(DataSource dataSource, - String task, String sql, SQLException ex); + String task, String sql, SQLException ex); /** * Translates the exception ex. @@ -40,7 +40,7 @@ public interface ExceptionTranslator { * the original exception. */ public RuntimeException translateException(Connection connection, - String task, String sql, SQLException ex); + String task, String sql, SQLException ex); /** * Returns an exception when a unique result is expected from the database, diff --git a/eodsql/src/net/lemnik/eodsql/impl/SelectMethodImplementationFactory.java b/eodsql/src/net/lemnik/eodsql/impl/SelectMethodImplementationFactory.java index 2fc6a10..692b48e 100644 --- a/eodsql/src/net/lemnik/eodsql/impl/SelectMethodImplementationFactory.java +++ b/eodsql/src/net/lemnik/eodsql/impl/SelectMethodImplementationFactory.java @@ -91,12 +91,12 @@ class SelectMethodImplementationFactory implements MethodImplementationFactory { private final boolean isConnectionResource(Resource r) { - return r.getResourceType() == Connection.class; + return r.getResourceType() == Connection.class; } /** diff --git a/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java b/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java index a03390c..1da2cd0 100644 --- a/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java +++ b/eodsql/src/net/lemnik/eodsql/spi/util/MapDataObjectBinding.java @@ -24,154 +24,154 @@ import net.lemnik.eodsql.EoDException; public class MapDataObjectBinding extends DataObjectBinding> { @Override public Class> getObjectType() { - return getStringObjectMapObjectType(); + return getStringObjectMapObjectType(); } @SuppressWarnings("unchecked") public static Class> getStringObjectMapObjectType() { - return (Class>) Collections. emptyMap().getClass(); + return (Class>) Collections. emptyMap().getClass(); } @Override public Map newInstance() throws EoDException { - return new HashMap(); + return new HashMap(); } @Override public void marshall(Map from, ResultSet results) - throws SQLException, EoDException { - final ResultSetMetaData metaData = results.getMetaData(); - for (Map.Entry entry : from.entrySet()) { - final int i = results.findColumn(entry.getKey()); - final int type = metaData.getColumnType(i); - if (entry.getValue() == null) { - results.updateNull(i); - continue; - } - switch (type) { - case Types.BIT: - case Types.BOOLEAN: - results.updateBoolean(i, (Boolean) entry.getValue()); - break; - case Types.CHAR: - case Types.VARCHAR: - case Types.LONGVARCHAR: - results.updateString(i, entry.getValue().toString()); - break; - case Types.DATE: - results.updateDate(i, new Date(((java.util.Date) entry - .getValue()).getTime())); - break; - case Types.TIME: - results.updateTime(i, new Time(((java.util.Date) entry - .getValue()).getTime())); - break; - case Types.TIMESTAMP: - results.updateTimestamp(i, new Timestamp( - ((java.util.Date) entry.getValue()).getTime())); - break; - case Types.DECIMAL: - case Types.NUMERIC: - results.updateBigDecimal(i, (BigDecimal) entry.getValue()); - break; - case Types.REAL: - results.updateFloat(i, (Float) entry.getValue()); - break; - case Types.DOUBLE: - case Types.FLOAT: - results.updateDouble(i, (Double) entry.getValue()); - break; - case Types.TINYINT: - results.updateByte(i, (Byte) entry.getValue()); - break; - case Types.SMALLINT: - results.updateShort(i, (Short) entry.getValue()); - break; - case Types.INTEGER: - results.updateInt(i, (Integer) entry.getValue()); - break; - case Types.BIGINT: - results.updateLong(i, (Long) entry.getValue()); - break; - case Types.BINARY: - case Types.VARBINARY: - case Types.LONGVARBINARY: - results.updateBytes(i, (byte[]) entry.getValue()); - break; - case Types.JAVA_OBJECT: - results.updateObject(i, entry.getValue()); - break; - case Types.ARRAY: - results.updateArray(i, (Array) entry.getValue()); - break; - } - } + throws SQLException, EoDException { + final ResultSetMetaData metaData = results.getMetaData(); + for (Map.Entry entry : from.entrySet()) { + final int i = results.findColumn(entry.getKey()); + final int type = metaData.getColumnType(i); + if (entry.getValue() == null) { + results.updateNull(i); + continue; + } + switch (type) { + case Types.BIT: + case Types.BOOLEAN: + results.updateBoolean(i, (Boolean) entry.getValue()); + break; + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + results.updateString(i, entry.getValue().toString()); + break; + case Types.DATE: + results.updateDate(i, new Date(((java.util.Date) entry + .getValue()).getTime())); + break; + case Types.TIME: + results.updateTime(i, new Time(((java.util.Date) entry + .getValue()).getTime())); + break; + case Types.TIMESTAMP: + results.updateTimestamp(i, new Timestamp( + ((java.util.Date) entry.getValue()).getTime())); + break; + case Types.DECIMAL: + case Types.NUMERIC: + results.updateBigDecimal(i, (BigDecimal) entry.getValue()); + break; + case Types.REAL: + results.updateFloat(i, (Float) entry.getValue()); + break; + case Types.DOUBLE: + case Types.FLOAT: + results.updateDouble(i, (Double) entry.getValue()); + break; + case Types.TINYINT: + results.updateByte(i, (Byte) entry.getValue()); + break; + case Types.SMALLINT: + results.updateShort(i, (Short) entry.getValue()); + break; + case Types.INTEGER: + results.updateInt(i, (Integer) entry.getValue()); + break; + case Types.BIGINT: + results.updateLong(i, (Long) entry.getValue()); + break; + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + results.updateBytes(i, (byte[]) entry.getValue()); + break; + case Types.JAVA_OBJECT: + results.updateObject(i, entry.getValue()); + break; + case Types.ARRAY: + results.updateArray(i, (Array) entry.getValue()); + break; + } + } } @Override public void unmarshall(ResultSet row, Map into) - throws SQLException, EoDException { - final ResultSetMetaData metaData = row.getMetaData(); - for (int i = 1; i <= metaData.getColumnCount(); ++i) { - final int type = metaData.getColumnType(i); - final String name = metaData.getColumnName(i); - switch (type) { - case Types.BIT: - case Types.BOOLEAN: - into.put(name, row.getBoolean(i)); - break; - case Types.CHAR: - case Types.VARCHAR: - case Types.LONGVARCHAR: - into.put(name, row.getString(i)); - break; - case Types.DATE: - into.put(name, row.getDate(i)); - break; - case Types.TIME: - into.put(name, row.getTime(i)); - break; - case Types.TIMESTAMP: - into.put(name, row.getTimestamp(i)); - break; - case Types.DECIMAL: - case Types.NUMERIC: - into.put(name, row.getBigDecimal(i)); - break; - case Types.REAL: - into.put(name, row.getFloat(i)); - break; - case Types.DOUBLE: - case Types.FLOAT: - into.put(name, row.getDouble(i)); - break; - case Types.TINYINT: - into.put(name, row.getByte(i)); - break; - case Types.SMALLINT: - into.put(name, row.getShort(i)); - break; - case Types.INTEGER: - into.put(name, row.getInt(i)); - break; - case Types.BIGINT: - into.put(name, row.getLong(i)); - break; - case Types.BINARY: - case Types.VARBINARY: - case Types.LONGVARBINARY: - into.put(name, row.getBytes(i)); - break; - case Types.JAVA_OBJECT: - into.put(name, row.getObject(i)); - break; - case Types.ARRAY: - into.put(name, row.getArray(i)); - break; - } - if (row.wasNull()) { - into.put(name, null); - } - } + throws SQLException, EoDException { + final ResultSetMetaData metaData = row.getMetaData(); + for (int i = 1; i <= metaData.getColumnCount(); ++i) { + final int type = metaData.getColumnType(i); + final String name = metaData.getColumnName(i); + switch (type) { + case Types.BIT: + case Types.BOOLEAN: + into.put(name, row.getBoolean(i)); + break; + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + into.put(name, row.getString(i)); + break; + case Types.DATE: + into.put(name, row.getDate(i)); + break; + case Types.TIME: + into.put(name, row.getTime(i)); + break; + case Types.TIMESTAMP: + into.put(name, row.getTimestamp(i)); + break; + case Types.DECIMAL: + case Types.NUMERIC: + into.put(name, row.getBigDecimal(i)); + break; + case Types.REAL: + into.put(name, row.getFloat(i)); + break; + case Types.DOUBLE: + case Types.FLOAT: + into.put(name, row.getDouble(i)); + break; + case Types.TINYINT: + into.put(name, row.getByte(i)); + break; + case Types.SMALLINT: + into.put(name, row.getShort(i)); + break; + case Types.INTEGER: + into.put(name, row.getInt(i)); + break; + case Types.BIGINT: + into.put(name, row.getLong(i)); + break; + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + into.put(name, row.getBytes(i)); + break; + case Types.JAVA_OBJECT: + into.put(name, row.getObject(i)); + break; + case Types.ARRAY: + into.put(name, row.getArray(i)); + break; + } + if (row.wasNull()) { + into.put(name, null); + } + } } } diff --git a/eodsql/src/net/lemnik/eodsql/spi/util/SingleRowResultSetWrapper.java b/eodsql/src/net/lemnik/eodsql/spi/util/SingleRowResultSetWrapper.java index 9e8da4b..8b8e602 100644 --- a/eodsql/src/net/lemnik/eodsql/spi/util/SingleRowResultSetWrapper.java +++ b/eodsql/src/net/lemnik/eodsql/spi/util/SingleRowResultSetWrapper.java @@ -12,20 +12,20 @@ import net.lemnik.eodsql.impl.ExceptionTranslationUtils; */ class SingleRowResultSetWrapper extends AbstractResultSetWrapper { SingleRowResultSetWrapper(final DataObjectBinding binding) { - super(binding); + super(binding); } @Override public T wrap(final ResultSet results) throws SQLException { - if (results.next()) { - final T wrapped = binding.unmarshall(results); - if (results.next()) { - throw ExceptionTranslationUtils.uniqueResultExpected(); - } - return wrapped; - } else { - return null; - } + if (results.next()) { + final T wrapped = binding.unmarshall(results); + if (results.next()) { + throw ExceptionTranslationUtils.uniqueResultExpected(); + } + return wrapped; + } else { + return null; + } } } diff --git a/eodsql/test/net/lemnik/eodsql/SelectIntoTest.java b/eodsql/test/net/lemnik/eodsql/SelectIntoTest.java index 76b7804..a001aec 100644 --- a/eodsql/test/net/lemnik/eodsql/SelectIntoTest.java +++ b/eodsql/test/net/lemnik/eodsql/SelectIntoTest.java @@ -17,12 +17,12 @@ public class SelectIntoTest extends EoDTestCase { @Override protected void tearDown() throws Exception { - try { - query.drop(); - query = null; - } finally { - super.tearDown(); - } + try { + query.drop(); + query = null; + } finally { + super.tearDown(); + } } public void testSelectInto() throws Exception { diff --git a/eodsql/test/net/lemnik/eodsql/TypesTest.java b/eodsql/test/net/lemnik/eodsql/TypesTest.java index beb5361..cde3eca 100644 --- a/eodsql/test/net/lemnik/eodsql/TypesTest.java +++ b/eodsql/test/net/lemnik/eodsql/TypesTest.java @@ -15,8 +15,8 @@ import java.util.UUID; * @author jason */ public class TypesTest extends EoDTestCase { - TypeQuery query=null; - + TypeQuery query=null; + public TypesTest(String testName) { super(testName); } @@ -67,14 +67,14 @@ public class TypesTest extends EoDTestCase { data.close(); } - @Override - protected void tearDown() throws Exception { - try { - query = QueryTool.getQuery(getConnection(), TypeQuery.class); - query.dropTable(); - } finally { - super.tearDown(); - } - } + @Override + protected void tearDown() throws Exception { + try { + query = QueryTool.getQuery(getConnection(), TypeQuery.class); + query.dropTable(); + } finally { + super.tearDown(); + } + } } -- 1.8.0