X-Git-Url: http://secure.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java index d17e8b0..86472fa 100644 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java @@ -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; } @@ -96,9 +110,11 @@ public abstract class DatabaseAdapter { } else if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP){ string = string.trim(); //Check if we have to strip the millisecods - String sub = string.substring(string.length() - 2, string.length() - 1); - if (string.length() > 1 && sub.equals(".")) //$NON-NLS-1$ - string = string.substring(0, string.length() - 2); // strip the milliseconds + if (string.length() > 2) { + String sub = string.substring(string.length() - 2, string.length() - 1); + if (string.length() > 1 && sub.equals(".")) //$NON-NLS-1$ + string = string.substring(0, string.length() - 2); // strip the milliseconds + } return "'" + string + "'"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -116,7 +132,7 @@ public abstract class DatabaseAdapter { * @return */ protected boolean isTextType(int type, String typeString) { - return SQLHelper.isText(type); + return TypesHelper.isText(type); } @@ -195,4 +211,28 @@ 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(); + } + + /** + * Returns the SQL Query to get a list of the Sysnonyms for the current user (schema), of the given type + * @param schema The schema to get the query for + * @param type The type of the synonym to get. Types can be one from the Entity types + * @return - A String with the SQL query + */ + public String getShowSynonymsQuery(String schema, String type) { + return null; + } } \ No newline at end of file