1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / adapters / PostgresAdapter.java
index 3283163..c31b5fe 100644 (file)
@@ -1,6 +1,8 @@
 package com.quantum.adapters;
 
-import com.quantum.sql.SQLHelper;
+import java.util.HashMap;
+import java.util.Map;
+
 import com.quantum.util.QuantumUtil;
 import com.quantum.util.sql.TypesHelper;
 
@@ -24,10 +26,10 @@ public class PostgresAdapter extends DatabaseAdapter {
                        "and pg_namespace.nspname = '" + qualifier + "'";
     }
        public String getNextValue(String sequence, String owner) {
-               return "SELECT NEXTVAL('" + SQLHelper.getQualifiedName(owner, sequence) + "')";
+               return "SELECT NEXTVAL('" + getQualifiedName(owner, sequence) + "')";
        }
        public String getPrevValue(String sequence, String owner) {
-               return "SELECT * FROM " + SQLHelper.getQualifiedName(owner, sequence);
+               return "SELECT * FROM " + getQualifiedName(owner, sequence);
        }
 
        /**
@@ -51,17 +53,21 @@ public class PostgresAdapter extends DatabaseAdapter {
                return super.quote(string, type, typeString);
        }
 
+       public String getTableQuery(String table) {
+               return "SELECT * FROM " + filterTableName(table); //$NON-NLS-1$
+       }
     /**
      * @see com.quantum.adapters.DatabaseAdapter#filterTableName(java.lang.String)
      */
     public String filterTableName(String tableName) {
         // If there is no mixed case, better not quote, it's prettier on display
-        if (tableName.equals(tableName.toUpperCase())) return tableName;
-        // We quote the table name (and only the table name) because it has mixed case
+       // Postgresql defaults to lower case identifiers
+        if (tableName.equals(tableName.toLowerCase())) return tableName;
+        // We quote the table name because it has mixed case
         if (QuantumUtil.getSchemaName(tableName).equals("")) {
-            return "\"" + tableName +"\""; //$NON-NLS-1$
+            return "\"" + tableName + "\""; //$NON-NLS-1$
         } else {
-            return QuantumUtil.getSchemaName(tableName) + ".\"" + 
+            return "\"" + QuantumUtil.getSchemaName(tableName) + "\".\"" + 
                     QuantumUtil.getTableName(tableName) + "\"";
         }
     }
@@ -72,4 +78,10 @@ public class PostgresAdapter extends DatabaseAdapter {
         return "public";
     }
 
+       public Map getDefaultConnectionParameters() {
+               Map map = new HashMap();
+               map.put("port", "5432");
+               map.put("hostname", "localhost");
+               return map;
+       }
 }
\ No newline at end of file