All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.aguacate.context.spi.sql.impl.SentenceSqlSelectSingle Maven / Gradle / Ivy

package net.sf.aguacate.context.spi.sql.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class SentenceSqlSelectSingle extends AbstractSentenceSqlSelect {

	private static final Logger LOGGER = LogManager.getLogger(SentenceSqlSelectSingle.class);

	public SentenceSqlSelectSingle(String name, String table, List methods, List required,
			List optional, String outputName) {
		super(name, table, methods, required, optional, outputName);
	}

	@Override
	Object extract(String[] optional, ResultSet resultSet) throws SQLException {
		if (resultSet.next()) {
			Object data = resultSet.getObject(1);
			if (resultSet.next()) {
				LOGGER.warn("multiple results");
			}
			return data;
		} else {
			return null;
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy