Commit 732e310d authored by Grégory Mantelet's avatar Grégory Mantelet
Browse files

[ADQL] Add an easy UDF translation. An SQL expression template can now be

provided. When done, all $$i (where i is the index of a parameter ; starting
from 1) are replaced by the SQL translation of the corresponding parameters.
parent 3509775a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -289,6 +289,10 @@ public class FunctionDef implements Comparable<FunctionDef> {
	 * @param returnType	Return type of the function.
	 *                  	<i>If NULL, this function will have no return
	 *                  	type.</i>
	 *
	 * @throws ParseException	If the given UDF name is invalid according to
	 *                       	the {@link ADQLParserFactory#DEFAULT_VERSION default version}
	 *                       	of the ADQL grammar.
	 */
	public FunctionDef(final String fctName, final DBType returnType) throws ParseException {
		this(fctName, returnType, null, null);
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package adql.db;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

+2 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class TestJDBCTranslator {
		 * particularly, ' should be escaped otherwise it would mean the end of a string in SQL
		 *(the way to escape a such character is by doubling the character '): */
		try{
==== BASE ====
			assertEquals("'SQL''s translation'", tr.translate(new StringConstant("SQL's translation")));
		} catch(TranslationException e) {
			e.printStackTrace(System.err);
+7 −7

File changed.

Contains only whitespace changes.