f00c5debf8da578d3b6e3d2fb2fcbb79ede53f4e
[mir.git] / source / mir / storage / DatabaseAdaptorPostgresql.java
1 package mir.storage;
2
3 import java.util.*;
4 import mir.misc.*;
5
6 /**
7  * <b>Diese Klasse implementiert die abstrakte Klasse DatabaseAdaptor für Postgresql-Datenbanken
8  *
9  * @author <RK>
10  * @version 30.12.2000
11  */
12
13 public final class DatabaseAdaptorPostgresql implements DatabaseAdaptor{
14
15 //    private static String url = "jdbc:postgresql://localhost:5432/mir";
16 // just testing
17
18     private static String url = "jdbc:postgresql://localhost:5432/mir_unstable";
19     private static String driver = "org.postgresql.Driver";
20
21     public String getDriver() {
22         return driver;
23     }
24
25     public String getURL(String user, String pass, String host) {
26             return url;
27     }
28
29     public static void setUrl(String u) throws Exception {
30         if (!url.startsWith("jdbc:"))
31             throw new Exception("Database Adaptor URL must begin with: \"jdbc:\"");
32         url = u;
33     }
34
35     public static void setDriver(String d) {
36         driver = d;
37     }
38
39     public  boolean hasLimit() {
40       return true;
41     }
42
43     public boolean reverseLimit() {
44       return true;
45     }
46
47     public Properties getProperties(String user, String password) {
48       return null;
49     }
50
51     public String getLastInsertSQL(Database theDB) {
52            return "select currval('"+theDB.getCoreTable()+"_id_seq')";
53     }
54 }
55
56