Commit 763168d2 authored by gmantele's avatar gmantele Committed by GitHub
Browse files

[ADQL,Build] Merge pull request #20 from vforchi/master

New build system (Gradle) and fixes in SQLServer translator (atan2 function, order of TOP and DISTINCT).
parents 704877d2 3952a24a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -85,3 +85,7 @@ All of these ANT scripts have the following main targets:
* `buildLibAndSrc`: same as `buildLib` + building of a JAR file containing all the sources and the required libraries.
* `buildJavadoc`: generate a JAR containing the Javadoc of the target library's classes.
* `buildAll`: equivalent of `buildLibAndSrc` and `buildJavadoc` together. The result is 3 JARs: one with the compiled classes, one with the corresponding sources and the last one with the Javadoc.

### Gradle build
The code can be built with Gradle, either as a jar file to be included in other projects 
or as a war file to be deployed in Tomcat.

build.gradle

0 → 100644
+21 −0
Original line number Diff line number Diff line
apply plugin: 'java'
apply plugin: 'war'

repositories {
    jcenter()
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile fileTree(dir: 'lib', include: '*.jar')
    compile 'javax.servlet:javax.servlet-api:3.0.1'
    compile 'postgresql:postgresql:9.1-901.jdbc4'

    testCompile 'simple-jndi:simple-jndi:0.11.4.1'
    testCompile 'junit:junit:4.12'
}

sourceSets.main.java.srcDirs = ["src"]
// the tests fail because they have environemnt specific parameters
// sourceSets.test.java.srcDirs = ["test"]
+8 −23
Original line number Diff line number Diff line
@@ -19,18 +19,9 @@ package adql.translator;
 * Copyright 2016 - Astronomisches Rechen Institut (ARI)
 */

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

import adql.db.DBChecker;
import adql.db.DBColumn;
import adql.db.DBTable;
import adql.db.DBType;
import adql.db.*;
import adql.db.DBType.DBDatatype;
import adql.db.DefaultDBColumn;
import adql.db.DefaultDBTable;
import adql.db.STCS.Region;
import adql.db.SearchColumnList;
import adql.db.exception.UnresolvedJoinException;
import adql.parser.ADQLParser;
import adql.parser.ParseException;
@@ -41,18 +32,10 @@ import adql.query.IdentifierField;
import adql.query.from.ADQLJoin;
import adql.query.operand.ADQLColumn;
import adql.query.operand.function.MathFunction;
import adql.query.operand.function.geometry.AreaFunction;
import adql.query.operand.function.geometry.BoxFunction;
import adql.query.operand.function.geometry.CentroidFunction;
import adql.query.operand.function.geometry.CircleFunction;
import adql.query.operand.function.geometry.ContainsFunction;
import adql.query.operand.function.geometry.DistanceFunction;
import adql.query.operand.function.geometry.ExtractCoord;
import adql.query.operand.function.geometry.ExtractCoordSys;
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 adql.query.operand.function.geometry.*;

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

/**
 * <p>MS SQL Server translator.</p>
@@ -189,7 +172,7 @@ public class SQLServerTranslator extends JDBCTranslator {

		for(int i = 0; i < clause.size(); i++){
			if (i == 0){
				sql = clause.getName() + (clause.hasLimit() ? " TOP " + clause.getLimit() + " " : "") + (clause.distinctColumns() ? " DISTINCT" : "");
				sql = clause.getName() + (clause.distinctColumns() ? " DISTINCT" : "") + (clause.hasLimit() ? " TOP " + clause.getLimit() + " " : "");
			}else
				sql += " " + clause.getSeparator(i);

@@ -343,6 +326,8 @@ public class SQLServerTranslator extends JDBCTranslator {
				return "round(" + ((fct.getNbParameters() >= 2) ? (translate(fct.getParameter(0)) + ", " + translate(fct.getParameter(1))) : "") + ",1)";
			case MOD:
				return ((fct.getNbParameters() >= 2) ? (translate(fct.getParameter(0)) + "% " + translate(fct.getParameter(1))) : "");
			case ATAN2:
				return "ATN2(" + translate(fct.getParameter(0)) + ", " + translate(fct.getParameter(1)) + ")";
			default:
				return getDefaultADQLFunction(fct);
		}
+1 −1

File changed.

Contains only whitespace changes.