/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * @return somethign which can provde the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ @Override public RewrittenStatement rewrite(final String sql, final Binding params, final StatementContext ctx) { final ParsedStatement stmt = new ParsedStatement(); try { final String parsedSql = parseString(sql, stmt, params); return new MyRewrittenStatement(parsedSql, stmt, ctx); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException( "Exception parsing for named parameter replacement", e, ctx); } }
i += Optional.ofNullable(pos).orElse(1); } catch (SQLException e) { throw new UnableToCreateStatementException(String.format( "Exception while binding '%s'", named_param), e, context);
BeanPropertyArguments(Object bean, StatementContext ctx, Foreman foreman) { this.bean = bean; this.ctx = ctx; this.foreman = foreman; try { this.info = Introspector.getBeanInfo(bean.getClass()); } catch (IntrospectionException e) { throw new UnableToCreateStatementException("Failed to introspect object which is supposed ot be used to" + " set named args for a statement via JavaBean properties", e, ctx); } }
BeanPropertyArguments(Object bean, StatementContext ctx, Foreman foreman) { this.bean = bean; this.ctx = ctx; this.foreman = foreman; try { this.info = Introspector.getBeanInfo(bean.getClass()); } catch (IntrospectionException e) { throw new UnableToCreateStatementException("Failed to introspect object which is supposed ot be used to" + " set named args for a statement via JavaBean properties", e, ctx); } }
public Argument find(String name) { for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (descriptor.getName().equals(name)) { try { return foreman.waffle(descriptor.getReadMethod().getReturnType(), descriptor.getReadMethod().invoke(bean), ctx); } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access excpetion invoking getter for " + "bean property [%s] on [%s]", name, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", name, bean), e, ctx); } } } return null; }
@Override public Argument find(String name) { for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (descriptor.getName().equals(name)) { try { return foreman.waffle(descriptor.getReadMethod().getReturnType(), descriptor.getReadMethod().invoke(bean), ctx); } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access excpetion invoking getter for " + "bean property [%s] on [%s]", name, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", name, bean), e, ctx); } } } return null; }
/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * @return something which can provide the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ @Override public RewrittenStatement rewrite(String sql, Binding params, StatementContext ctx) { ParsedStatement stmt = cache.get(sql); if (stmt == null) { try { stmt = parseString(sql); cache.put(sql, stmt); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx); } } return new MyRewrittenStatement(stmt, ctx); }
/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * * @return something which can provide the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ @Override public RewrittenStatement rewrite(String sql, Binding params, StatementContext ctx) { ParsedStatement stmt = cache.get(sql); if (stmt == null) { try { stmt = parseString(sql); cache.put(sql, stmt); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx); } } return new MyRewrittenStatement(stmt, ctx); }
private String wrapLookup(String sql) { try { return locator.locate(sql, this.getContext()); } catch (Exception e) { throw new UnableToCreateStatementException("Exception thrown while looking for statement", e, getContext()); } }
private String wrapLookup(String sql) { try { return locator.locate(sql, this.getContext()); } catch (Exception e) { throw new UnableToCreateStatementException("Exception thrown while looking for statement", e, getContext()); } }
/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * @return somethign which can provde the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ public RewrittenStatement rewrite(String sql, Binding params, StatementContext ctx) { final ParsedStatement stmt = new ParsedStatement(); try { final String parsedSql = parseString(sql, stmt); return new MyRewrittenStatement(parsedSql, stmt, ctx); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx); } }
throw new UnableToCreateStatementException(e.getMessage(), e, ctx);
throw new UnableToCreateStatementException(e.getMessage(), e, ctx);
/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * * @return somethign which can provde the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ public RewrittenStatement rewrite(String sql, Binding params, StatementContext ctx) { final ParsedStatement stmt = new ParsedStatement(); try { final String parsedSql = parseString(sql, stmt); return new MyRewrittenStatement(parsedSql, stmt, ctx); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx); } }
/** * Munge up the SQL as desired. Responsible for figuring out ow to bind any * arguments in to the resultant prepared statement. * * @param sql The SQL to rewrite * @param params contains the arguments which have been bound to this statement. * @param ctx The statement context for the statement being executed * @return somethign which can provde the actual SQL to prepare a statement from * and which can bind the correct arguments to that prepared statement */ @Override public RewrittenStatement rewrite(final String sql, final Binding params, final StatementContext ctx) { final ParsedStatement stmt = new ParsedStatement(); try { final String parsedSql = parseString(sql, stmt, params); return new MyRewrittenStatement(parsedSql, stmt, ctx); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException( "Exception parsing for named parameter replacement", e, ctx); } }
public Object map(ResolvedMethod method, Query q, HandleDing h) { if (method.getRawMember().isAnnotationPresent(Mapper.class)) { final ResultSetMapper mapper; try { mapper = method.getRawMember().getAnnotation(Mapper.class).value().newInstance(); } catch (Exception e) { throw new UnableToCreateStatementException("unable to access mapper", e); } return result(q.map(mapper), h); } else { return result(q.mapTo(mapTo(method)), h); } }
public Object map(ResolvedMethod method, Query q, HandleDing h) { if (method.getRawMember().isAnnotationPresent(Mapper.class)) { final ResultSetMapper mapper; try { mapper = method.getRawMember().getAnnotation(Mapper.class).value().newInstance(); } catch (Exception e) { throw new UnableToCreateStatementException("unable to access mapper", e); } return result(q.map(mapper), h); } else { return result(q.mapTo(mapTo(method)), h); } }
throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext()); throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext()); throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext());
throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext()); throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext()); throw new UnableToCreateStatementException("unable to apply customizer", e, q.getContext());
throw new UnableToCreateStatementException("Unable to instantiate result set mapper for statement", e);