1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.tableserver.jdbc.postgres;
12
13 import java.io.IOException;
14 import org.astrogrid.tableserver.jdbc.StdSqlMaker;
15 import org.astrogrid.query.Query;
16
17 /***
18 * Produced Postgres-specific SQL. This means:
19 * <p>
20 * * All <> are replaced by &&
21 * <p>
22 * * No aggregate functions in WHERE
23 * <p>
24 * * Trig functions assume radians as arguments
25 */
26 public class PostgresSqlMaker extends StdSqlMaker {
27
28 /***
29 * Constructs an SQL statement for the given ADQL.
30 */
31 public String makeSql(Query query) throws IOException {
32
33 String stdSql = super.makeSql(query);
34
35 String postgresSql = stdSql.replaceAll("<>","&&");
36
37 return postgresSql;
38 }
39
40 /***
41 * Constructs an SQL statement for the given ADQL.
42 */
43 public String makeCountSql(Query query) throws IOException {
44
45 String stdSql = super.makeCountSql(query);
46
47 String postgresSql = stdSql.replaceAll("<>","&&");
48
49 return postgresSql;
50 }
51
52 }
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71