* [ 1638208 ] WAN: Update record error

This commit is contained in:
Heng Sin Low 2007-01-19 02:50:03 +00:00
parent 8f71508fb3
commit 128c76ca31
1 changed files with 102 additions and 79 deletions

View File

@ -51,6 +51,16 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba
log.log(Level.SEVERE, e.getMessage()); log.log(Level.SEVERE, e.getMessage());
} }
**/ **/
// teo [ bug 1638208 ]: oracle 10g DATETIME issue
// http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#08_01
try
{
System.setProperty("oracle.jdbc.V8Compatible", "true");
}
catch (Exception e)
{
log.log(Level.SEVERE, e.getMessage());
}
} // DB_Oracle } // DB_Oracle
/** Static Driver */ /** Static Driver */
@ -789,95 +799,108 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba
/** /**
* Get Data Type * Get Data Type
* @param columnName
* @param displayType display type * @param displayType display type
* @param precision precision * @param precision precision
* @param defaultValue if true adds default value * @param defaultValue if true adds default value
* @return data type * @return data type
*/ */
public String getDataType (int displayType, int precision, public String getDataType (String columnName, int displayType, int precision,
boolean defaultValue) boolean defaultValue)
{ {
String retValue = null; String retValue = null;
switch (displayType) //handle special case, bug [ 1618423 ]
if (columnName != null)
{ {
// IDs if (displayType == DisplayType.Button
case DisplayType.Account: && columnName.endsWith("_ID"))
case DisplayType.Assignment: {
case DisplayType.Color:
case DisplayType.ID:
case DisplayType.Location:
case DisplayType.Locator:
case DisplayType.PAttribute:
case DisplayType.Search:
case DisplayType.Table:
case DisplayType.TableDir:
case DisplayType.Image:
retValue = "NUMBER(10)"; retValue = "NUMBER(10)";
break; }
}
// Dynamic Precision if (retValue == null)
case DisplayType.Amount: {
retValue = "NUMBER"; switch (displayType)
if (defaultValue) {
retValue += " DEFAULT 0"; // IDs
break; case DisplayType.Account:
case DisplayType.Assignment:
case DisplayType.Binary: case DisplayType.Color:
retValue = "BLOB"; case DisplayType.ID:
break; case DisplayType.Location:
case DisplayType.Locator:
case DisplayType.Button: case DisplayType.PAttribute:
retValue = "CHAR(1)"; case DisplayType.Search:
break; case DisplayType.Table:
case DisplayType.TableDir:
// Number Dynamic Precision case DisplayType.Image:
case DisplayType.CostPrice: retValue = "NUMBER(10)";
retValue = "NUMBER"; break;
if (defaultValue)
retValue += " DEFAULT 0"; // Dynamic Precision
break; case DisplayType.Amount:
retValue = "NUMBER";
// Date if (defaultValue)
case DisplayType.Date: retValue += " DEFAULT 0";
case DisplayType.DateTime: break;
case DisplayType.Time:
retValue = "DATE"; case DisplayType.Binary:
if (defaultValue) retValue = "BLOB";
retValue += " DEFAULT SYSDATE"; break;
break;
case DisplayType.Button:
// Number(10) retValue = "CHAR(1)";
case DisplayType.Integer: break;
retValue = "NUMBER(10)";
break; // Number Dynamic Precision
case DisplayType.CostPrice:
case DisplayType.List: retValue = "NUMBER";
retValue = "CHAR(" + precision + ")"; if (defaultValue)
break; retValue += " DEFAULT 0";
break;
// NVARCHAR
case DisplayType.Memo: // Date
case DisplayType.String: case DisplayType.Date:
case DisplayType.Text: case DisplayType.DateTime:
retValue = "NVARCHAR(" + precision + ")"; case DisplayType.Time:
break; retValue = "DATE";
if (defaultValue)
case DisplayType.TextLong: retValue += " DEFAULT SYSDATE";
retValue = "CLOB"; break;
break;
// Number(10)
// Dyn Prec case DisplayType.Integer:
case DisplayType.Quantity: retValue = "NUMBER(10)";
retValue = "NUMBER"; break;
break;
case DisplayType.List:
case DisplayType.YesNo: retValue = "CHAR(" + precision + ")";
retValue = "CHAR(1)"; break;
break;
// NVARCHAR
default: case DisplayType.Memo:
log.severe("Unknown: " + displayType); case DisplayType.String:
break; case DisplayType.Text:
retValue = "NVARCHAR(" + precision + ")";
break;
case DisplayType.TextLong:
retValue = "CLOB";
break;
// Dyn Prec
case DisplayType.Quantity:
retValue = "NUMBER";
break;
case DisplayType.YesNo:
retValue = "CHAR(1)";
break;
default:
log.severe("Unknown: " + displayType);
break;
}
} }
return retValue; return retValue;
} // getDataType } // getDataType