SQL Plugin copied from Quantum plugin and refactored for PHPEclipse
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / adapters / DatabaseAdapter.java
diff --git a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/adapters/DatabaseAdapter.java b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/adapters/DatabaseAdapter.java
new file mode 100644 (file)
index 0000000..0dd42e6
--- /dev/null
@@ -0,0 +1,34 @@
+package net.sourceforge.phpdt.sql.adapters;
+
+public abstract class DatabaseAdapter {
+       public abstract DatabaseAdapter getInstance();
+    public abstract String getShowTableQuery(DatabaseInfo info);
+    public String getShowViewQuery(DatabaseInfo info) {
+        throw new FeatureNotSupported("Views");
+    }
+    public String getShowSequenceQuery(DatabaseInfo info) {
+        throw new FeatureNotSupported("Sequences");
+    }
+       public final String getShowTableQuery(DatabaseInfo info, String table) {
+               String schema = info.getSchema();
+               if (schema.equals("")) {
+               return "SELECT * FROM " + table;
+               } else {
+               return "SELECT * FROM " + info.getSchema() + "." + table;
+               }
+       }
+    public final String getTableCountQuery(DatabaseInfo info, String table) {
+               String schema = info.getSchema();
+               if (schema.equals("")) {
+               return "SELECT COUNT(*) FROM " + table;
+               } else {
+               return "SELECT COUNT(*) FROM " + info.getSchema() + "." + table;
+               }
+    }
+    public String getNextValue(String sequence) {
+        throw new FeatureNotSupported("Sequences");
+    }
+    public String getTableListFilter() {
+        return null;
+    }
+}
\ No newline at end of file