package com.quantum.adapters;
+import java.util.HashMap;
+import java.util.Map;
+
import com.quantum.Messages;
-import com.quantum.sql.SQLHelper;
import com.quantum.util.QuantumUtil;
return "SELECT SEQUENCE_OWNER, SEQUENCE_NAME FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + qualifier + "'"; //$NON-NLS-1$
}
public String getPrevValue(String sequence, String owner) {
- return "SELECT LAST_NUMBER FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + owner + "' AND SEQUENCE_NAME = '" + sequence + "'"; //$NON-NLS-1$ //$NON-NLS-2$
- }
+ return "SELECT " + getQualifiedName(owner, sequence) + ".CURRVAL FROM DUAL";
+ }
public String getNextValue(String sequence, String owner) {
- return "SELECT " + SQLHelper.getQualifiedName(owner, sequence) + ".NEXTVAL FROM DUAL";
+ return "SELECT " + getQualifiedName(owner, sequence) + ".NEXTVAL FROM DUAL";
}
public String getCommentsQuery(String tableName, String column) {
String query = "SELECT COMMENTS FROM ALL_COL_COMMENTS WHERE TABLE_NAME = '";
public String quote(String string, int type, String typeString) {
if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP) {
string = string.trim();
- String sub = string.substring(string.length()-2, string.length()-1);
- if (string.length() > 1 && sub.equals(Messages.getString("OracleAdapter.._3"))) //$NON-NLS-1$
- string = string.substring(0,string.length()-2);
+ // Eliminate the fractions of seconds, if present
+ if (string.length() > 1) {
+ // If the third character from the end is a dot, it means it has fractions
+ String sub = string.substring(string.length()-2, string.length()-1);
+ if ( sub.equals(Messages.getString("."))) //$NON-NLS-1$
+ string = string.substring(0,string.length()-2);
+ }
return "TO_DATE('" + string + "','yyyy-mm-dd hh24:mi:ss')"; //$NON-NLS-1$ //$NON-NLS-2$
}
// use the default (upper type)
public String getDefaultSchema(String userid) {
return super.getDefaultSchema(userid).toUpperCase();
}
-
+
+ public Map getDefaultConnectionParameters() {
+ Map map = new HashMap();
+ map.put("port", "1521");
+ map.put("hostname", "localhost");
+ return map;
+ }
+
+ /* (non-Javadoc)
+ * @see com.quantum.adapters.DatabaseAdapter#getShowSynonymsQuery(java.lang.String, java.lang.String)
+ */
+ public String getShowSynonymsQuery(String schema, String type) {
+ // The type string is the same as the one needed by Oracle. If it changes a switch would be needed.
+ return "select SYNONYM_NAME from ALL_SYNONYMS, ALL_OBJECTS where " +
+ " ALL_SYNONYMS.OWNER = '" + schema + "'" +
+ " and ALL_SYNONYMS.TABLE_OWNER = ALL_OBJECTS.OWNER" +
+ " and ALL_SYNONYMS.TABLE_NAME = ALL_OBJECTS.OBJECT_NAME" +
+ " and ALL_OBJECTS.OBJECT_TYPE = '" + type + "'" ;
+ }
}
\ No newline at end of file