Initial version from the webtools project; sligthly modified for phpeclipse
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / adapters / DatabaseAdapter.java
index d17e8b0..1917e9f 100644 (file)
@@ -1,7 +1,11 @@
 package com.quantum.adapters;
 
-import com.quantum.sql.SQLHelper;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.quantum.Messages;
 import com.quantum.util.StringUtil;
+import com.quantum.util.sql.TypesHelper;
 
 /**
  * Abstract base class for all the adapter classes. Most functions can be redefined in
@@ -12,12 +16,22 @@ import com.quantum.util.StringUtil;
  */
 public abstract class DatabaseAdapter {
     
+       private final String type;
+       
+       protected DatabaseAdapter(String type) {
+               this.type = type;
+       }
+       
+       public String getDisplayName() {
+               return Messages.getString(DatabaseAdapter.class, getType());
+       }
+       
        /**
         * Returns the SQL Query to get a list of the tables for the current user (schema) 
         * @param info
         * @return - A String with the SQL query 
         */
-       public String getShowTableQuery(String schema, boolean isDefault) {
+       public String getShowTableQuery(String schema) {
                return null;
        }
        /**
@@ -25,7 +39,7 @@ public abstract class DatabaseAdapter {
         * @param info
         * @return - A String with the SQL query
         */
-       public String getShowViewQuery(String schema, boolean isDefault) {
+       public String getShowViewQuery(String schema) {
                return null;
        }
        /**
@@ -33,7 +47,7 @@ public abstract class DatabaseAdapter {
         * @param info
         * @return - A String with the SQL query
         */
-       public String getShowSequenceQuery(String schema, boolean isDefault) {
+       public String getShowSequenceQuery(String schema) {
         return null;
        }
 
@@ -116,7 +130,7 @@ public abstract class DatabaseAdapter {
      * @return
      */
     protected boolean isTextType(int type, String typeString) {
-        return SQLHelper.isText(type);
+        return TypesHelper.isText(type);
     }
     
     
@@ -195,4 +209,18 @@ public abstract class DatabaseAdapter {
     public String getDefaultSchema(String userid) {
         return userid;
     }
+       /**
+        * @return Returns the type.
+        */
+       public String getType() {
+               return this.type;
+       }
+
+       protected String getQualifiedName(String schema, String name) {
+               return (schema != null && schema.length() > 0) ? schema + "." + name : name;
+       }
+       
+       public Map getDefaultConnectionParameters() {
+               return new HashMap();
+       }
 }
\ No newline at end of file