Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.zalando.sprocwrapper.proxy.executors;
 
 import java.util.Date;
 import java.util.Map;
 
 

Author(s):
jmussler
public class SingleRowSimpleTypeExecutor implements Executor {
    public static final Map<ClassClassSIMPLE_TYPES = new HashMap<ClassClass>();
    static {
        // sproc with VOID result has type PGobject in Java
        .put(Void.classPGobject.class);
        .put(void.classPGobject.class);
        .put(Integer.classInteger.class);
        .put(Short.classShort.class);
        .put(String.classString.class);
        .put(Float.classFloat.class);
        .put(Double.classDouble.class);
        .put(Long.classLong.class);
        .put(Boolean.classBoolean.class);
        .put(int.classInteger.class);
        .put(long.classLong.class);
        .put(short.classShort.class);
        .put(float.classFloat.class);
        .put(double.classDouble.class);
        .put(boolean.classBoolean.class);
        .put(Date.classDate.class);
        .put(java.sql.Timestamp.classjava.sql.Timestamp.class);
    }
    public static Class mapReturnType(final Class returnType) {
        final Class clazz = .get(returnType);
        if (clazz != null) {
            return clazz;
        }
        return returnType;
    }
    @Override
    public Object executeSProc(final DataSource dsfinal String sqlfinal Object[] argsfinal int[] types,
            final InvocationContext invocationContextfinal Class<?> returnType) {
        return (new JdbcTemplate(ds)).queryForObject(sqlargstypesmapReturnType(returnType));
    }
New to GrepCode? Check out our FAQ X