Commit b8138111 authored by gmantele's avatar gmantele
Browse files

[ADQL] Allow modification of JDBCTranslator.appendIdentifier(., ., boolean).

This function was originally static. Since no other classes benefits of this
static state, this function is no longer static. This might however raise a
small incompatibility for the users of the library which used it.
parent 9a0f1022
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -16,14 +16,13 @@ package adql.translator;
 * You should have received a copy of the GNU Lesser General Public License
 * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright 2015 - Astronomisches Rechen Institut (ARI)
 * Copyright 2015-2016 - Astronomisches Rechen Institut (ARI)
 */

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import tap.data.DataReadException;
import adql.db.DBColumn;
import adql.db.DBTable;
import adql.db.DBType;
@@ -78,6 +77,7 @@ import adql.query.operand.function.geometry.IntersectsFunction;
import adql.query.operand.function.geometry.PointFunction;
import adql.query.operand.function.geometry.PolygonFunction;
import adql.query.operand.function.geometry.RegionFunction;
import tap.data.DataReadException;

/**
 * <p>Implementation of {@link ADQLTranslator} which translates ADQL queries in SQL queries.</p>
@@ -167,7 +167,7 @@ import adql.query.operand.function.geometry.RegionFunction;
 * </p>
 * 
 * @author Gr&eacute;gory Mantelet (ARI)
 * @version 1.4 (09/2015)
 * @version 1.4 (04/2016)
 * @since 1.4
 * 
 * @see PostgreSQLTranslator
@@ -294,13 +294,26 @@ public abstract class JDBCTranslator implements ADQLTranslator {
	}

	/**
	 * Appends the given identifier in the given StringBuffer.
	 * <p>Appends the given identifier in the given StringBuffer.</p>
	 * 
	 * <p>
	 * 	This function just call {@link #appendIdentifier(StringBuffer, String, boolean)}
	 * 	with the same 2 first parameters. The third one is the result of:
	 * 	<code>{@link #isCaseSensitive(IdentifierField) isCaseSensitive(field)}</code>.
	 * </p>
	 * 
	 * <p><i>Note:
	 * 	In order to keep a consistent output of the <code>appendIdentifier(...)</code> functions,
	 * 	this function can not be overwritten ; it is just a shortcut function.
	 * </i></p>
	 * 
	 * @param str		The string buffer.
	 * @param id		The identifier to append.
	 * @param field		The type of identifier (column, table, schema, catalog or alias ?).
	 * 
	 * @return			The string buffer + identifier.
	 * 
	 * @see #appendIdentifier(StringBuffer, String, boolean)
	 */
	public final StringBuffer appendIdentifier(final StringBuffer str, final String id, final IdentifierField field){
		return appendIdentifier(str, id, isCaseSensitive(field));
@@ -315,7 +328,7 @@ public abstract class JDBCTranslator implements ADQLTranslator {
	 * 
	 * @return					The string buffer + identifier.
	 */
	public static final StringBuffer appendIdentifier(final StringBuffer str, final String id, final boolean caseSensitive){
	public StringBuffer appendIdentifier(final StringBuffer str, final String id, final boolean caseSensitive){
		if (caseSensitive)
			return str.append('"').append(id).append('"');
		else