Return text generated by this fragment for a PreparedStatement

@param context A ControlBeanContext instance.
@param m       The annotated method.
@param args    The method's parameters
@return Always returns a PREPARED_STATEMENT_SUB_MARK
11139
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
        // this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment
        // if so it changes the behavior a bit.
        Object val = getParameterValue(context, m, args);
        if (val instanceof JdbcControl.ComplexSqlFragment) {
            return ((JdbcControl.ComplexSqlFragment)val).getSQL();
        } else {
            return PREPARED_STATEMENT_SUB_MARK;
        }
    }
1339964
public static PreparedStatement prepareStatement(Connection conn, String sql, Collection<Object> params) throws SQLException {
		return prepareStatement(conn, sql, params.toArray(new Object[params.size()]));
	}
302034
private Object getParameterValue(ControlBeanContext context, Method method, Object[] args) {
        Object value;
        try {
            value = context.getParameterValue(method, _nameQualifiers[0], args);
        } catch (IllegalArgumentException iae) {
            throw new ControlException("Invalid argument name in SQL statement: " + _nameQualifiers[0], iae);
        }

        for (int i = 1; i < _nameQualifiers.length; i++) {
            // handle maps, properties, and fields...
            value = extractValue(value, _nameQualifiers[i - 1], _nameQualifiers[i]);
        }
        return value;
    }
304742
public PreparedStatementCreator page(final Dialect dialect, final int limit, final int offset) {
        return new PreparedStatementCreator() {
            public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
                return getPreparedStatementCreator()
                .setSql(dialect.createPageSelect(builder.toString(), limit, offset))
                .createPreparedStatement(con);
            }
        };
    }
287431
private int bindStatementValue(PreparedStatement stmt, int index, Object attributeOrQuery, Object value, ClassDescriptor cld)
            throws SQLException
    {
        FieldDescriptor fld = null;
        // if value is a subQuery bind it
        if (value instanceof Query)
        {
            Query subQuery = (Query) value;
            return bindStatement(stmt, subQuery, cld.getRepository().getDescriptorFor(subQuery.getSearchClass()), index);
        }

        // if attribute is a subQuery bind it
        if (attributeOrQuery instanceof Query)
        {
            Query subQuery = (Query) attributeOrQuery;
            bindStatement(stmt, subQuery, cld.getRepository().getDescriptorFor(subQuery.getSearchClass()), index);
        }
        else
        {
            fld = cld.getFieldDescriptorForPath((String) attributeOrQuery);
        }

        if (fld != null)
        {
            // BRJ: use field conversions and platform
            if (value != null)
            {
                m_platform.setObjectForStatement(stmt, index, fld.getFieldConversion().javaToSql(value), fld.getJdbcType().getType());
            }
            else
            {
                m_platform.setNullForStatement(stmt, index, fld.getJdbcType().getType());
            }
        }
        else
        {
            if (value != null)
            {
                stmt.setObject(index, value);
            }
            else
            {
                stmt.setNull(index, Types.NULL);
            }
        }

        return ++index; // increment before return
    }
347456
public PreparedStatement getPreparedStatement(ClassDescriptor cds, String sql,
                                                  boolean scrollable, int explicitFetchSizeHint, boolean callableStmt)
            throws PersistenceBrokerException
    {
        try
        {
            return cds.getStatementsForClass(m_conMan).getPreparedStmt(m_conMan.getConnection(), sql, scrollable, explicitFetchSizeHint, callableStmt);
        }
        catch (LookupException e)
        {
            throw new PersistenceBrokerException("Used ConnectionManager instance could not obtain a connection", e);
        }
    }
878967
public String getMessage(Context context) {
        if (customMessage != null) {
            return customMessage;
        }
        return context.getResources().getString(message);
    }
161906
public static SqlContext getSqlContext(BeanDescFactory beanDescFactory, Object param) {
        SqlContext context = new SqlContextImpl();

        if (param != null) {
            BeanDesc beanDesc = beanDescFactory.getBeanDesc(param);
            for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) {
                PropertyDesc pd = beanDesc.getPropertyDesc(i);
                context.addArg(pd.getPropertyName(), pd.getValue(param), pd
                        .getPropertyType());
            }
        }

        return context;
    }
1112673
@Override
	public int[] doBatch(final SqlContext sqlContext, final PreparedStatement preparedStatement, final int[] result) {
		if (LOG.isDebugEnabled()) {
			int[] counts = result;
			try {
				counts = new int[] { preparedStatement.getUpdateCount() };
			} catch (SQLException ex) {
				ex.printStackTrace();
			}

			StringBuilder builder = new StringBuilder();
			for (int val : counts) {
				builder.append(val).append(", ");
			}
			LOG.debug("SQL:{} executed. Result:{}", sqlContext.getSqlName(), builder.toString());
		}
		return result;
	}
477650
public static Template<?> createTemplate(Context context, MethodTree decl) {
    MethodSymbol declSym = ASTHelpers.getSymbol(decl);
    ImmutableClassToInstanceMap<Annotation> annotations = UTemplater.annotationMap(declSym);
    ImmutableMap<String, VarSymbol> freeExpressionVars = freeExpressionVariables(decl);
    Context subContext = new SubContext(context);
    final UTemplater templater = new UTemplater(freeExpressionVars, subContext);
    ImmutableMap<String, UType> expressionVarTypes =
        ImmutableMap.copyOf(
            Maps.transformValues(
                freeExpressionVars, (VarSymbol sym) -> templater.template(sym.type)));

    UType genericType = templater.template(declSym.type);
    List<UTypeVar> typeParameters;
    UMethodType methodType;
    if (genericType instanceof UForAll) {
      UForAll forAllType = (UForAll) genericType;
      typeParameters = forAllType.getTypeVars();
      methodType = (UMethodType) forAllType.getQuantifiedType();
    } else if (genericType instanceof UMethodType) {
      typeParameters = ImmutableList.of();
      methodType = (UMethodType) genericType;
    } else {
      throw new IllegalArgumentException(
          "Expected genericType to be either a ForAll or a UMethodType, but was " + genericType);
    }

    List<? extends StatementTree> bodyStatements = decl.getBody().getStatements();
    if (bodyStatements.size() == 1
        && Iterables.getOnlyElement(bodyStatements).getKind() == Kind.RETURN
        && context.get(REQUIRE_BLOCK_KEY) == null) {
      ExpressionTree expression =
          ((ReturnTree) Iterables.getOnlyElement(bodyStatements)).getExpression();
      return ExpressionTemplate.create(
          annotations,
          typeParameters,
          expressionVarTypes,
          templater.template(expression),
          methodType.getReturnType());
    } else {
      List<UStatement> templateStatements = new ArrayList<>();
      for (StatementTree statement : bodyStatements) {
        templateStatements.add(templater.template(statement));
      }
      return BlockTemplate.create(
          annotations, typeParameters, expressionVarTypes, templateStatements);
    }
  }
995412
private Map<String, Object> createMessageVariables(final Context context) {
        
        final Map<String, Object> vars = new HashMap<>();
        
        if(context instanceof MessageInterpolatorContext) {
            MessageInterpolatorContext mic = (MessageInterpolatorContext)context;
            vars.putAll(mic.getMessageParameters());
        }
        
        final ConstraintDescriptor<?> descriptor = context.getConstraintDescriptor();
        for(Map.Entry<String, Object> entry : descriptor.getAttributes().entrySet()) {
            final String attrName = entry.getKey();
            final Object attrValue = entry.getValue();
            
            vars.put(attrName, attrValue);
        }
        
        // 検証対象の値
        vars.computeIfAbsent("validatedValue", key -> context.getValidatedValue());
        
        // デフォルトのメッセージ
        final String defaultCode = String.format("%s.message", descriptor.getAnnotation().annotationType().getCanonicalName());
        final Optional<String> defaultMessage = messageResolver.getMessage(defaultCode);
        
        vars.put(defaultCode, 
                defaultMessage.orElseThrow(() -> new RuntimeException(String.format("not found message code '%s'", defaultCode))));
        
        
        return vars;
        
    }
187306
protected PreparedStatement getPreparedStatement(final SqlContext sqlContext) throws SQLException {
		PreparedStatement stmt = ((LocalTransactionManager) transactionManager).getPreparedStatement(sqlContext);
		// プロパティ設定
		applyProperties(stmt);
		return stmt;
	}
873720
private StatementHandler getStatementHandler(Class<? extends StatementHandler> statementHandlerClazz) {
        StatementHandler result = null;
        Constructor<? extends StatementHandler> constructor = null;

        Class<? extends StatementHandler> clazz = statementHandlerClazz;

        try {
            constructor = clazz.getConstructor(Overrider.class);
            result = constructor.newInstance(overrider);
        } catch (SecurityException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        } catch (NoSuchMethodException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        } catch (IllegalArgumentException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        } catch (InstantiationException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        } catch (IllegalAccessException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        } catch (InvocationTargetException e) {
            throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
        }

        return result;
    }
1030245
public int bindStatement(PreparedStatement stmt, Query query, ClassDescriptor cld, int param) throws SQLException
    {
        int result;

        result = bindStatement(stmt, query.getCriteria(), cld, param);
        result = bindStatement(stmt, query.getHavingCriteria(), cld, result);

        return result;
    }
344497
public PreparedStatement prepareStatement(final String _string,
                                              final int _returnGeneratedKeys)
        throws SQLException
    {

        return getConnection().prepareStatement(_string, _returnGeneratedKeys);
    }
886618
public void createPreparedStatement(String query, List<Object> params) throws SQLException {

        m_preparedStatement = m_connection.prepareStatement(query);

        // Check the params
        if (params != null) {
            for (int i = 0; i < params.size(); i++) {
                Object item = params.get(i);

                // Check if the parameter is a string
                if (item instanceof String) {
                    m_preparedStatement.setString(i + 1, (String)item);
                }
                if (item instanceof Integer) {
                    Integer number = (Integer)item;
                    m_preparedStatement.setInt(i + 1, number.intValue());
                }
                if (item instanceof Long) {
                    Long longNumber = (Long)item;
                    m_preparedStatement.setLong(i + 1, longNumber.longValue());
                }

                // If item is none of types above set the statement to use the bytes
                if (!(item instanceof Integer) && !(item instanceof String) && !(item instanceof Long)) {
                    try {
                        m_preparedStatement.setBytes(i + 1, CmsDataTypeUtil.dataSerialize(item));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

    }
1182191
public static String build(String messageSelector, Map<String, Object> messageSelectorMap, TestContext context) {
        if (StringUtils.hasText(messageSelector)) {
            return context.replaceDynamicContentInString(messageSelector);
        } else if (!CollectionUtils.isEmpty(messageSelectorMap)) {
            return MessageSelectorBuilder.fromKeyValueMap(
                    context.resolveDynamicValuesInMap(messageSelectorMap)).build();
        }

        return "";
    }