View Javadoc

1   /*$Id: PostgresSqlMaker.java,v 1.1 2005/03/10 16:42:55 mch Exp $
2    * Created on 27-Nov-2003
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid
7    * Software License version 1.2, a copy of which has been included
8    * with this distribution in the LICENSE.txt file.
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  $Log: PostgresSqlMaker.java,v $
57  Revision 1.1  2005/03/10 16:42:55  mch
58  Split fits, sql and xdb
59  
60  Revision 1.1.1.1  2005/02/17 18:37:35  mch
61  Initial checkin
62  
63  Revision 1.1.1.1  2005/02/16 17:11:24  mch
64  Initial checkin
65  
66  Revision 1.3.12.2  2004/12/08 23:23:37  mch
67  Made SqlWriter and AdqlWriter implement QueryVisitor
68  
69   
70  */
71