IDEMPIERE-4395 Cannot save valid strings in oracle - ORA-12899: value too large for column (#202)

This commit is contained in:
Carlos Ruiz 2020-08-06 16:35:37 +02:00 committed by GitHub
parent c17f1ae733
commit a84adbad80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 8 deletions

View File

@ -381,6 +381,13 @@ public interface AdempiereDatabase
*/
public String getVarcharDataType();
/**
* @return variable length character data type suffix
*/
public default String getVarcharLengthSuffix() {
return "";
};
/**
*
* @return binary large object data type name
@ -461,5 +468,6 @@ public interface AdempiereDatabase
*/
public String getSQLModify (MTable table, MColumn column, boolean setNullOption);
} // AdempiereDatabase

View File

@ -384,7 +384,7 @@ public abstract class Convert
} catch (Exception e) {
String error = "Error expression: " + regex + " - " + e;
log.info(error);
log.warning(error);
m_conversionError = error;
}
}

View File

@ -624,7 +624,7 @@ public final class DisplayType
{
if (columnName.equals("EntityType")
|| columnName.equals ("AD_Language"))
return getDatabase().getVarcharDataType() + "(" + fieldLength + ")";
return getDatabase().getVarcharDataType() + "(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")";
// ID
if (DisplayType.isID(displayType))
{
@ -640,7 +640,7 @@ public final class DisplayType
else if (fieldLength < 4)
return getDatabase().getCharacterDataType()+"(" + fieldLength + ")";
else // EntityType, AD_Language fallback
return getDatabase().getVarcharDataType()+"(" + fieldLength + ")";
return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")";
}
//
if (displayType == DisplayType.Integer)
@ -660,10 +660,10 @@ public final class DisplayType
if (fieldLength == 1)
return getDatabase().getCharacterDataType()+"(" + fieldLength + ")";
else
return getDatabase().getVarcharDataType()+"(" + fieldLength + ")";
return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")";
}
if (displayType == DisplayType.Color)
return getDatabase().getVarcharDataType()+"(" + fieldLength + ")";
return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")";
if (displayType == DisplayType.Button)
{
if (columnName.endsWith("_ID"))
@ -685,7 +685,7 @@ public final class DisplayType
if (columnName.endsWith("_ID"))
return getDatabase().getNumericDataType()+"(10)";
return getDatabase().getVarcharDataType()+"(" + fieldLength + ")";
return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")";
} // getSQLDataType
/**

View File

@ -1371,6 +1371,13 @@ public class DB_Oracle implements AdempiereDatabase
return "VARCHAR2";
}
/**
* @return variable length character data type suffix
*/
public String getVarcharLengthSuffix() {
return " CHAR";
};
@Override
public String getBlobDataType() {
return "BLOB";

View File

@ -40,7 +40,11 @@ public final class ConvertMap_PostgreSQL {
// Data Types
s_pg.put("\\bNUMBER\\b", "NUMERIC");
s_pg.put("\\bDATE\\b", "TIMESTAMP");
s_pg.put("\\bVARCHAR2\\b", "VARCHAR");
// because map is ordered this replacement is executed after VARCHAR2 above, so here we have just VARCHAR
s_pg.put("\\bVARCHAR\\b( *\\( *[1-9][0-9]*) *CHAR\\)", "VARCHAR$1)");
s_pg.put("\\bNVARCHAR2\\b", "VARCHAR");
s_pg.put("\\bNCHAR\\b", "CHAR");
//begin vpj-cd e-evolution 03/11/2005 PostgreSQL