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

com.moparisthebest.jdbc.InList Maven / Gradle / Ivy

The newest version!
package com.moparisthebest.jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;

/**
 * For a column name and a Collection, return a Object usable by QueryMapper for binding to a PreparedStatement and
 * ListQueryMapper for substituting in the query
 */
public interface InList {

	/**
	 * Returns an Object who's .toString returns a String for a query, and QueryMapper knows how to bind to a PreparedStatement
	 * @param columnName Column name for query
	 * @param values values for in list
	 * @return object
	 */
	public  InListObject inList(final Connection conn, final String columnName, final Collection values) throws SQLException;

	class InListObject {
		static final InListObject empty = new InListObject("(0=1)");

		private final String sql;

		public InListObject(final String sql) {
			this.sql = sql;
		}

		@Override
		public final String toString() {
			return sql;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy