icon

CodeTrigger   Forum

Code Generation For C#, WPF, WCF, SQL SERVER/ORACLE/MYSQL and Visual Studio 2013-2017

HomeGeneral

General Discussion Board - Please post questions, answers, (polite) opinions, and use-cases. Moderators reserve the right to amend the text/subject line or re-categorise the post to better suit the forum configuration if necessary.

Oracle Number(31) column used for ID column Messages in this topic - RSS

migrator
04/12/2017
migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
PeopleSoft tables contain Number(31) columns that it uses for “ID” type columns. CodeTrigger treats these as .Net decimal types which causes data overflow issues in the business layer. One of the approaches we have used with these colums is to apply Oracle to_char functions and treat them as strings. Can something like this be done with CodeTrigger?
0 link
04/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
If you look in the generated Data Access Base Class: XXXXBaseData.Cs, you will see a section called BoxRowValue. This is where some special processing is placed to handle Number(1). The function is designed for such cases, so I think the best approach might be to look at that function and make some changes in there to handle Number(31). Might be best to just write a safe convert to decimal in that function for the Number(31) case. Please let me know how you get on as we would be very interested in this UseCase.


#region oracle parameter helpers
protected static object BoxRowValue(object value, string entityName, string fieldName)
{
//write any necessary conversion code
if(entityName == "sometablename" && fieldName == anumber31fieldName) return mySafeConvertFunction(value);

//for eg change up from NUMBER(1) to boolean if required
return (object)(value != null ? ((short)value != 0) : default(bool));
}

protected virtual object UnboxOracleParam(OracleParameter oracleParam, string entityName)
{
...
...
}
0 link
04/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
UPDATE
Release 4.8.6.2 (June 2016)
Added Support for non native Boolean field representation for Oracle - using Number(1) convention
Added support for Identity Fields in Oracle 12+
edited by migrator on 12/4/2017
0 link