0dd42e6aeab597e85109f018ed9d679650edb573
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / adapters / DatabaseAdapter.java
1 package net.sourceforge.phpdt.sql.adapters;
2
3 public abstract class DatabaseAdapter {
4         public abstract DatabaseAdapter getInstance();
5     public abstract String getShowTableQuery(DatabaseInfo info);
6     public String getShowViewQuery(DatabaseInfo info) {
7         throw new FeatureNotSupported("Views");
8     }
9     public String getShowSequenceQuery(DatabaseInfo info) {
10         throw new FeatureNotSupported("Sequences");
11     }
12         public final String getShowTableQuery(DatabaseInfo info, String table) {
13                 String schema = info.getSchema();
14                 if (schema.equals("")) {
15                 return "SELECT * FROM " + table;
16                 } else {
17                 return "SELECT * FROM " + info.getSchema() + "." + table;
18                 }
19         }
20     public final String getTableCountQuery(DatabaseInfo info, String table) {
21                 String schema = info.getSchema();
22                 if (schema.equals("")) {
23                 return "SELECT COUNT(*) FROM " + table;
24                 } else {
25                 return "SELECT COUNT(*) FROM " + info.getSchema() + "." + table;
26                 }
27     }
28     public String getNextValue(String sequence) {
29         throw new FeatureNotSupported("Sequences");
30     }
31     public String getTableListFilter() {
32         return null;
33     }
34 }