protected QueryResultWrapper performQuery(final String rawMdxQuery, final DataRow parameters)
throws ReportDataFactoryException, SQLException
{
final PreparedOlapStatement statement = getStatement(rawMdxQuery, parameters);
final OlapParameterMetaData data = statement.getParameterMetaData();
final int count = data.getParameterCount();
for (int i = 0; i < count; i++)
{
final String parameterName = data.getParameterName(i + 1);
statement.setObject(i + 1, parameters.get(parameterName));
}
final Object queryTimeout = parameters.get(DataFactory.QUERY_TIMEOUT);
final int queryTimeoutValue;
if (queryTimeout instanceof Number)
{
final Number i = (Number) queryTimeout;
queryTimeoutValue = i.intValue();
}
else
{
// means unlimited ...
queryTimeoutValue = 0;
}
if (queryTimeoutValue > 0)
{
statement.setQueryTimeout(queryTimeoutValue);
}
final OlapParameterMetaData olapParameterMetaData = statement.getParameterMetaData();
final int paramCount = olapParameterMetaData.getParameterCount();
for (int i = 1; i <= paramCount; i++)
{
final String paramName = olapParameterMetaData.getParameterName(i);
Object parameterValue = parameters.get(paramName);
if (parameterValue != null)
{
final Type parameterType = olapParameterMetaData.getParameterOlapType(i);
if (parameterType instanceof StringType)
{
if (!(parameterValue instanceof String))
{
throw new ReportDataFactoryException(parameterValue + " is incorrect for type " + parameterType);